By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 889 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

SMTP code times out. No idea why

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
"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

P: n/a

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

P: n/a
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.