smtp replyto MailAddress

What am I missing on my reply to line in the attached screen print?

screen print
Larry Bristersr. DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JohnBusiness Consultant (Owner)Commented:
What is the above from and where do you enter the setting in Outlook? I assumed Outlook. In any event, what are you setting?
0
Larry Bristersr. DeveloperAuthor Commented:
I am sending emails to an SMTP API at SendGrid

I need a different reply to than the from address
0
JohnBusiness Consultant (Owner)Commented:
Can you indicate how you set?  Not all such setups allow "Reply to"
0
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

Larry Bristersr. DeveloperAuthor Commented:
This is pretty much all the code... and imports
the variable transportWeb is the actual api i'm consuming

Imports System.Data.SqlClient
Imports System.Net.Mail
Imports System.IO
Imports System.Net
Imports SendGrid
Imports Newtonsoft.Json
Imports System.Configuration

Dim EmailFrom As String = ""
Dim Emailx As String = ""
' Dim Mailserverx As String = ""
EmailFrom = dR4("FromName") & "-" & "<" & "us@mydomain.com" & " > """
Emailx = dR4("EmailAddress").ToString()
replyToAddress = dR4("ReplyAddress").ToString() + ""
Dim recipients As New List(Of [String])() From {dR4("EmailAddress").ToString() + ""}
Dim customArgs As New Dictionary(Of String, String)()
customArgs.Add("campaign_id", dR4("campaignid").ToString() + "")
customArgs.Add("Customer_ID", dR4("Customer_ID").ToString() + "")

Dim myMessage = New SendGridMessage()
myMessage.AddTo(recipients)
myMessage.From = New MailAddress(fromAddress)

myMessage.Subject = EmailSubject
myMessage.Html = HTML
myMessage.AddUniqueArgs(customArgs)
Dim credentials = New NetworkCredential(sgUsername, sgPassword)
' Create a Web transport for sending email.
Dim transportWeb = New Web(credentials)

' Send the email.
transportWeb.Deliver(myMessage)

Open in new window

0
JohnBusiness Consultant (Owner)Commented:
Thanks. When you insert a verifiable in replyToAddress = and run the code, what error do you get?
0
Larry Bristersr. DeveloperAuthor Commented:
The error is in my screen print in the original question in the console window

Essentially Value of 'MailAddress' cannot be converted to 'MailAddress()'
0
JohnBusiness Consultant (Owner)Commented:
Thanks. That was confusing for me to sort out from the screen print. So the function you want is not supported.
0
Shaun KlineLead Software EngineerCommented:
It would appear that the ReplyTo property in SendGrid expects an array of addresses, not a single address.
0
Larry Bristersr. DeveloperAuthor Commented:
Shaun... how do I set that array?
0
KimputerCommented:
myMessage.ReplyToList.Add(replyToAddress)

So, remove whole ReplyTo line
0
Shaun KlineLead Software EngineerCommented:
You can use the New Array() constructor when you want an array that is not typed to a specific data type, or you can use New String ().

To create and assign all in one line, you can do:

myMessage.ReplyTo = New String() { replyToAddress }
0
Larry Bristersr. DeveloperAuthor Commented:
Kimputer
myMessage is a SendGridMessage()
Dim myMessage = New SendGridMessage()
Insite of that...

....
Public Property From As MailAddress
Public Property ReplyTo As MailAddress()

Inside of that...
Public Class MailAddress
Public Sub New(address As String)
Public Sub New(address As String, displayName As String)
Public Sub New(address As String, displayName As String, displayNameEncoding As Encoding)
0
Larry Bristersr. DeveloperAuthor Commented:
I was told to set replyto to this????
How does that transpose in my sub?

'reply_to': {
    'email': 'sam.smith@example.com',
    'name': 'Sam Smith'
  }
0
Shaun KlineLead Software EngineerCommented:
The MailAddress has three constructors. The one that takes two strings can be used to assign email address and DisplayName.
So:
New MailAddress("sam.smith@example.com", "Sam Smith")

To add it as a ReplyTo on your MailMessage object, try this:

myMessage.ReplyTo = { New MailAddress("sam.smith@example.com", "Sam Smith") }
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Larry Bristersr. DeveloperAuthor Commented:
Bingo!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.