Possible Duplicate:
send email asp.net c#
I have sent mail several times using the technique several times before but somehow it doesnt work i am providing the code in the following:
MailMessage myMailMessage = new MailMessage();
myMailMessage.Subject = "Response From Client";
myMailMessage.Body = "hello word";
myMailMessage.From = new MailAddress("mymail@gmail.com", "jub");
myMailMessage.To.Add(new MailAddress("mymail@gmail.com", "Softden"));
SmtpClient mySmtpClient = new SmtpClient();
mySmtpClient.Send(myMailMessage);
and my web.config is:
<mailSettings>
<smtp deliveryMethod = "Network" from="Jubair <mymail@gmail.com>">
<network defaultCredentials="false" enableSsl="true" userName="mymail@gmail.com" password="Mypassword" host="smtp.gmail.com" port="587"></network>
</smtp>
</mailSettings>
it says the smtp server requires a secure connection or the client was not authenticated.. Please help
Try adding something like this
Per Dominic’s answer on Stackoverflow look at he following example
//—————– A simple approach below —————
I just tested this below and it works
var mail = new MailMessage();
//The .config settings there are two options on how you could set this up I am suspecting that this is the issue you are having
or option 2