Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

SendGrid SMTP Send Mail Message .Net

I am getting the following message on my ReplyTo line below.

Value of type 'MailAddress' cannot be converted to 'MailAddress()'.
Without that mail sends perfectly fine however.

Little help?
            Dim recipients As New List(Of [String])() From {Emailx + ""}
            Dim customArgs As New Dictionary(Of String, String)()
            customArgs.Add("campaign_id", "ewCID9999")
            customArgs.Add("Customer_ID", "ewCUSID123")

            Dim myMessage = New SendGridMessage()
            myMessage.AddTo(recipients)
            myMessage.From = New MailAddress(fromAddress) 'fromAddress
            Dim tReply = New MailAddress("myaddress@mydomain.com")

            myMessage.Subject = "TEST NEW USER"
            myMessage.Html = "TEST HTML <br /><br /><br />LB"
            myMessage.AddUniqueArgs(customArgs)
            myMessage.ReplyTo = tReply
            Dim credentials = New NetworkCredential(sgUsername, sgPassword)
            ' Create a Web transport for sending email.
            Dim transportWeb = New Web(credentials)

Open in new window


User generated image
Avatar of Kimputer
Kimputer

Type is wrong, fix it like this:

        Dim replyaddresses As New List(Of MailAddress)
        Dim tReply = New MailAddress("myaddress@mydomain.com")
        replyaddresses.Add(tReply)
        myMessage.ReplyToList(replyaddresses)

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Larry Brister
Larry Brister
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Larry Brister

ASKER

Found my own solution.