Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29748

Email sending using SMTP not working with asp.net

$
0
0

I'm trying to send email using SMTP in asp.net. Following code is not working.

public string send_email(string name, string email, string message)
{
    var fromAddress = email;
    var toAddress = "ashish_sharma307@hotmail.com";
    string subject = "Feedback";
    string body = "From: " + name+ "\n";
    body += "Email: " + email + "\n";
    body += "Subject: " + subject + "\n";
    body += "Question: \n" + message + "\n";
    // smtp settings
    var smtp = new System.Net.Mail.SmtpClient();
    {
        smtp.Host = "smtp.live.com";
        smtp.Port = 587;
    }
    smtp.Send(fromAddress, toAddress, subject, body);


    return "Your query has been submitted.";
}

This is not working as per expected. I'm trying to send an email from feedback form.


Viewing all articles
Browse latest Browse all 29748

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>