469,920 Members | 2,232 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,920 developers. It's quick & easy.

SMTP code times out. No idea why

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("ce@gmail.com"));

mail.From = new MailAddress("xy*@iinet.net.au",
"Developers", System.Text.Encoding.UTF8);

mail.ReplyTo = new MailAddress("so***@wikid.com");
mail.Subject = "Your moma";
mail.Attachments.Add(new Attachment(@"c:\sqmdata00.sqm"));
mail.DeliveryNotificationOptions =
DeliveryNotificationOptions.OnSuccess;

mysmtp.DeliveryMethod = SmtpDeliveryMethod.Network;
mysmtp.Send(mail);

Nov 6 '07 #1
4 1384
Vince wrote:
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.

--
Göran Andersson
_____
http://www.guffa.com
Nov 6 '07 #2
"pop" is for receiving mail. Shouldn't the host be "smtp.xxxx"?
Peter
--
http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"Vince" wrote:
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("ce@gmail.com"));

mail.From = new MailAddress("xy*@iinet.net.au",
"Developers", System.Text.Encoding.UTF8);

mail.ReplyTo = new MailAddress("so***@wikid.com");
mail.Subject = "Your moma";
mail.Attachments.Add(new Attachment(@"c:\sqmdata00.sqm"));
mail.DeliveryNotificationOptions =
DeliveryNotificationOptions.OnSuccess;

mysmtp.DeliveryMethod = SmtpDeliveryMethod.Network;
mysmtp.Send(mail);

Nov 6 '07 #3

I have a gmail sample you can download at:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry

Get the downloadable code. And change a few settings.

"Vince" <pa************@gmail.comwrote in message
news:11**********************@e34g2000pro.googlegr oups.com...
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("ce@gmail.com"));

mail.From = new MailAddress("xy*@iinet.net.au",
"Developers", System.Text.Encoding.UTF8);

mail.ReplyTo = new MailAddress("so***@wikid.com");
mail.Subject = "Your moma";
mail.Attachments.Add(new Attachment(@"c:\sqmdata00.sqm"));
mail.DeliveryNotificationOptions =
DeliveryNotificationOptions.OnSuccess;

mysmtp.DeliveryMethod = SmtpDeliveryMethod.Network;
mysmtp.Send(mail);

Nov 6 '07 #4
Peter Bromberg [C# MVP] wrote:
"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.
Nov 6 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Von Shean | last post: by
2 posts views Thread by Latha Rajeev | last post: by
5 posts views Thread by Charlie | last post: by
1 post views Thread by Brian Bischof | last post: by
5 posts views Thread by Prashant Barnwal | last post: by
34 posts views Thread by antonyliu2002 | last post: by
reply views Thread by =?Utf-8?B?UmljaA==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.