EmailMessage Sender's name

I want to be able to send an email from a webservice I am currently making.
How can I show my name in the address field.
I tried this in the MailFrom Field:

dim msg as new EmailMessage
msg.FromAddress = "My Name <info@domain.com>"

But that doesn’t work. Should I use a header instead?

This should work. Can you be a bit more concrete than “doesn’t work”? Can you post your code and how the mail ends up at your mail client?

Well… The SMTP secure socket keeps firing error code 22.
And I have no idea what that means. Error 22 is not documented in the SMTPSecureSocket

A little bit of google, and tada, maxprog thread on the issue: http://www.maxprog.com/forum/viewtopic.php?t=5149
Maxprog uses Xojo so I would bet the result is the same.

[quote=252478:@Tim Parnell]A little bit of google, and tada, maxprog thread on the issue: http://www.maxprog.com/forum/viewtopic.php?t=5149
Maxprog uses Xojo so I would bet the result is the same.[/quote]

In the documentation of SocketCore.LastErrorCode I see a link.
From what I understand it means “Invalid Argument”.

I don’t use port 25. My server uses port 465 for SSL connections. I entered the correct username and password.
Do you think I need to include certificates?

When I set SMTP.Secure = False, and set the correct non-secure port number, 587 in my case… everything works well.
But to be able to send mail through a secure connection would be nice.

It may be that it’s not responding because you’re not using the right security type.
Which security setting are you using?

I used the smtp.ModeSSLTLS connectionmode and all the different security types.
smtp.SSLv23 should work, not?

Do you use MBS Plugins?
If you send via CURL and our CurlEmailMBS class, you can set from with name and email and the plugin will make sure the name is encoded properly.

Well… I found a way to add a name to the FromAddress.
In the message object I must not assign anything to the FromAddress property. Instead I add a header:

mail.Headers.AppendHeader "From", mailFromName + " <" + mailFromAddress + ">"

But thanks @Christian Schmitz for the help. I will stick with this method for now.

I am still dealing with the whole SSL thing though. But I think I should start another conversation for that. SSL is kind of off-topic, I think :slight_smile:

Edwin: sorry, this is nonsense. There is no difference between

mail.Headers.AppendHeader "From", mailFromName + " <" + mailFromAddress + ">"

and

msg.FromAddress = "My Name <info@domain.com>"

Additionally, this has nothing to do with your socket issue.

[quote=252567:@Beatrix Willius]Edwin: sorry, this is nonsense. There is no difference between

mail.Headers.AppendHeader "From", mailFromName + " <" + mailFromAddress + ">"

and

msg.FromAddress = "My Name <info@domain.com>"

Additionally, this has nothing to do with your socket issue.[/quote]

Yeah, I had a typo in my initial code. One I didn’t see at all. My bad. Thanks though

I know. Like I mentioned… I should start a new conversation about that. There might be other users that deal with the same problem.