473,385 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 1478
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Von Shean | last post by:
I need to send ".mht" files to different recipients. I have saved .mht files using CDO. Now i have to send it across.. I have two options both have different types of problems Using CDO I...
10
by: ahager via DotNetMonster.com | last post by:
I am receiving this messaage in a console application I wrote, I am authenticating, and my network admin swears their is nothing wrong with the smtp server. Any ideas? public void Mail_update()...
2
by: Latha Rajeev | last post by:
Hi, I have an application which sends out mails(using CDO), the SMTP Server being a machine which is one the same network. Most times, the mails are sent out successfully but every once in a...
5
by: Charlie | last post by:
Hi: I'm working on an e-commerce site. Using the SMTP class, my site sends out confirmation messages. It works most of the time, but sometimes raises an error. I need a way of making sure it...
1
by: Brian Bischof | last post by:
In my Win app I found that using the SMTP object doesn't release resources after closing the application. During testing I have to open and close the app many times and I found that after about three...
5
by: Prashant Barnwal | last post by:
Hi, This message i get whne i try to send mails theu my app server. any idea where and what to look for? It works fine in Dev bed. Guide me to apprpriate news group if its not the right place. ...
34
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow...
0
by: =?Utf-8?B?UmljaA==?= | last post by:
Hello, My company will be hosting a webcast, and I need to send out 2000 individual emails to people who signed up (for login information...). I created an smtp app that I can loop through...
7
by: Rob Dob | last post by:
The following code is giving me a timeout problem., no matter what I do I can't send a piece of mail using .net2.0 System.Net.Mail.SmtpClient via port 465 and using ssl, if however I try using...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.