Hi guys, I think I have another asp.net question. I'm trying to send an email using smtp authentication via google, but I constantly get a timeout error and don’t know that it could be from the following code, not my firewall or my isp is blocking the smtp ports, so most likely this is the code:
MailMessage msg = new MailMessage();
String BodyMsg;
BodyMsg = "Hey " + TxtBoxUsername.Text + "@" + "Welcome to Tiamo your username and password are:@Username: "
+ TxtBoxUsername.Text + "@Password: " + PasswordString + "@You have succesffully registered, you can now login."
+ "@Thank You@Tiamo Team";
BodyMsg = BodyMsg.Replace("@", System.Environment.NewLine);
msg.To.Add(new MailAddress(TxtBoxEmail.Text));
msg.From = new MailAddress("someemail@emailme.com");
msg.Subject = "Re: Welcome to Tiamo";
msg.Body = BodyMsg;
SmtpClient client = new SmtpClient() ;
client.EnableSsl = true;
client.Send(msg);
and these are my smtp email settings for web.config:
<system.net>
<mailSettings>
<smtp from="someemail@myemail.com">
<network host="smtp.gmail.com" port="465" userName="someemail@myemail.com" password="MyLovelyPassword" defaultCredentials="true"/>
</smtp>
</mailSettings>
I was completely exhausted, so I thought that the best thing is to ask a question, I hope that you can help him, everyone will be very grateful ... thanks anicho.
source
share