SMTP code times out. No idea why

  • Thread starter Thread starter Vince
  • Start date Start date
V

Vince

Can someone help me here please? My code keeps timing out on the very
last line. POP3 works fine.

The port is 465 and the host is pop.googlemail.com

Thank you

SmtpClient mysmtp = new SmtpClient();

if (useSSL) {
mysmtp.EnableSsl = true;
}
mysmtp.Port = port;
mysmtp.Host = host;
mysmtp.Credentials = new NetworkCredential(user, pass);

MailMessage mail = new MailMessage();
mail.To.Add(new MailAddress("(e-mail address removed)"));

mail.From = new MailAddress("(e-mail address removed)",
"Developers", System.Text.Encoding.UTF8);

mail.ReplyTo = new MailAddress("(e-mail address removed)");
mail.Subject = "Your moma";
mail.Attachments.Add(new Attachment(@"c:\sqmdata00.sqm"));
mail.DeliveryNotificationOptions =
DeliveryNotificationOptions.OnSuccess;

mysmtp.DeliveryMethod = SmtpDeliveryMethod.Network;
mysmtp.Send(mail);
 
Vince said:
Can someone help me here please? My code keeps timing out on the very
last line. POP3 works fine.

The port is 465 and the host is pop.googlemail.com

Does your ISP allow traffic on the 465 port? Some ISPs block that port,
and requires you to use their smtp server, to prevent spamming.
 
Peter said:
"pop" is for receiving mail. Shouldn't the host be "smtp.xxxx"?
Peter

You are 100% correct here, according to my mail client settings, I use
smtp.gmail.com (which is the same actual box as smtp.googlemail.com) for
outbound gmail traffic.

It's always necessary to configure your mail client settings based on
your service provider.


Chris.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top