none
MailSettings smtp from setting RRS feed

  • Question

  • I have the following configuration:

    <system.net>
        <mailSettings>
          <smtp deliveryMethod="Network" from="ro-reply@qms.com.br">
            <network enableSsl="true" defaultCredentials="false" host="smtp.live.com" port="587" userName="joberto@blabla.com.br" password="blablabla"/>
          </smtp>
        </mailSettings>
      </system.net>

    What is the purpose of the "from" in smtp tag?

    I thought it would be the "from" when you receive an email, but currently the "from" is joberto@blabla.com.br. Here's my code:

    var message = new MailMessage
                {
                    Subject = email.Subject,
                    Body = email.Body,
                    IsBodyHtml = true
                };
                message.To.Add(email.To);
    
                var client = new SmtpClient();
                client.Send(message);


    Take a look at WPF FlashMessage
    About.me

    Wednesday, February 26, 2014 8:39 PM

Answers

  • You are correct, the from attribute is the sender of the email.

    http://msdn.microsoft.com/en-us/library/ms164240%28v=vs.110%29.aspx

    However I see you are using smtp.live.com as a server using your login credentials and it is likely that live.com always uses the email associated with your login as sender of the emails. This is to avoid spoofing, you can only send emails via smtp.live.com as the logged in user.

    • Marked as answer by Joba Diniz Wednesday, February 26, 2014 10:09 PM
    Wednesday, February 26, 2014 10:01 PM
    Moderator

All replies