?
Solved

smtp replyto MailAddress

Posted on 2016-08-17
15
Medium Priority
?
84 Views
Last Modified: 2016-08-17
What am I missing on my reply to line in the attached screen print?

screen print
0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 3
  • +1
15 Comments
 
LVL 98

Expert Comment

by:John Hurst
ID: 41759327
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
 

Author Comment

by:lrbrister
ID: 41759334
I am sending emails to an SMTP API at SendGrid

I need a different reply to than the from address
0
 
LVL 98

Expert Comment

by:John Hurst
ID: 41759339
Can you indicate how you set?  Not all such setups allow "Reply to"
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:lrbrister
ID: 41759345
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
 
LVL 98

Expert Comment

by:John Hurst
ID: 41759351
Thanks. When you insert a verifiable in replyToAddress = and run the code, what error do you get?
0
 

Author Comment

by:lrbrister
ID: 41759355
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
 
LVL 98

Expert Comment

by:John Hurst
ID: 41759358
Thanks. That was confusing for me to sort out from the screen print. So the function you want is not supported.
0
 
LVL 27

Expert Comment

by:Shaun Kline
ID: 41759361
It would appear that the ReplyTo property in SendGrid expects an array of addresses, not a single address.
0
 

Author Comment

by:lrbrister
ID: 41759392
Shaun... how do I set that array?
0
 
LVL 36

Expert Comment

by:Kimputer
ID: 41759406
myMessage.ReplyToList.Add(replyToAddress)

So, remove whole ReplyTo line
0
 
LVL 27

Expert Comment

by:Shaun Kline
ID: 41759409
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
 

Author Comment

by:lrbrister
ID: 41759419
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
 

Author Comment

by:lrbrister
ID: 41759763
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
 
LVL 27

Accepted Solution

by:
Shaun Kline earned 2000 total points
ID: 41759833
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
 

Author Closing Comment

by:lrbrister
ID: 41759834
Bingo!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello Friends, My friends and relatives always ask me how to delete all the various types of emails at once in our g-mail  or windows live account.  So I researched this topic to find a unique solution to this query.  Here it is for those who do …
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question