Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

smpt client for windows 7

Posted on 2011-09-26
15
Medium Priority
?
450 Views
Last Modified: 2012-05-12
Hi experts,

I have used following c# code to send emails from my workplace

 SmtpClient client = new SmtpClient("clinmed.gla.ac.uk");
            MailMessage objEmail = new MailMessage();
            objEmail.From = new MailAddress(m_EmailFrom);
            objEmail.To.Add(new MailAddress(m_EmailTo));
            objEmail.Subject = m_EmailSubject;
            objEmail.Body = m_EmailMessage;
            objEmail.IsBodyHtml = true;
            client.Send(objEmail);

We have an smtp client "clinmed.gla.ac.uk" at work.

Now at home on my personal pc I need to do some testing. Can I download and install some free smtp client like i have used above to test sending email?
0
Comment
Question by:mmalik15
  • 7
  • 4
  • 2
  • +2
15 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 36598677
run your windows setup (add remove programs from the control panel), there is a SMTP installation (part of IIS if I am not mistaken)
0
 

Author Comment

by:mmalik15
ID: 36598689
Sorry I am using windows 7 professional sp1 and checked windows features already and it does not have smtp client option
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 36598793
I think what you're looking for is an SMTP server (not a client, which is what you're instantiating with the .NET Framework).  Is there some reason you can't use "clinmed.gla.ac.uk" from home?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:mmalik15
ID: 36598985
I have tried connecting to "clinmed.gla.ac.uk" but the exception i get is "Unable to connect to the remote server".
0
 
LVL 11

Accepted Solution

by:
Sudhakar Pulivarthi earned 1600 total points
ID: 36598994
Hi,
You can use any public mail server like gmail to test ur code to send mails using that account.
SmtpClient client = new SmtpClient("smtp.gmail.com", 25); // If not try port 587
            MailMessage objEmail = new MailMessage();
            objEmail.From = new MailAddress(m_EmailFrom); // gmail mail id
            objEmail.To.Add(new MailAddress(m_EmailTo)); // any valid mail id
            objEmail.Subject = m_EmailSubject;
            objEmail.Body = m_EmailMessage;
             // Set the user credentials.
             objEmail.Credentials = new NetworkCredential("gmail user name", "gmail password");
             objEmail.EnableSsl = true
            objEmail.IsBodyHtml = true;
            client.Send(objEmail);
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 36598995
Ah, well, if you have an account at one of several free e-mail providers you might be able to use one of their servers:

http://www.emailaddressmanager.com/tips/mail-settings.html

0
 
LVL 11

Expert Comment

by:Sudhakar Pulivarthi
ID: 36599027
hi mmalik15,

Please do check and provide the port number (default is 25, which can be omitted) in the mail server "clinmed.gla.ac.uk"  using which clients from outside the network can connect to the mail server to send mails. Because inter network mails could have been able to connect with default port, but its not publicily accessible from outsiode.
There might be a provision to send mails from outside network through some other port if provided by your company admin team. If not, you can use any public mail server as specified above.
0
 

Author Comment

by:mmalik15
ID: 36599149
thanks for the comments
I have tried this without any luck

  MailMessage objEmail = new MailMessage();
            objEmail.From = new MailAddress(m_EmailFrom);
            objEmail.To.Add(new MailAddress(m_EmailTo));
            objEmail.Subject = m_EmailSubject;
            objEmail.Body = m_EmailMessage;
            objEmail.IsBodyHtml = true;


           SmtpClient client = new SmtpClient("smtp.gmail.com", 25);
            client.Credentials = new NetworkCredential("myemailID@gmail.com", "xxxxxxxx");
            client.EnableSsl = true;


            client.Send(objEmail);

The exception i m getting now is


"An attempt was made to access a socket in a way forbidden by its access permissions 209.85.227.109:25"}"
0
 

Author Comment

by:mmalik15
ID: 36599175
I have also tried with port 587. And did try clinmed using port 25 and 587 but could not connect
0
 
LVL 11

Expert Comment

by:Sudhakar Pulivarthi
ID: 36599193
Please turn off firewall and check... antivirus might be blocking..
please turn them off and check once...
0
 

Author Comment

by:mmalik15
ID: 36599295
windows firewall and antivirus are both disabled still no luck i have also tried telnet

C:\Users\MehtabM>telnet smtp.gmail.com 587
Connecting To smtp.gmail.com...Could not open connection to the host, on port 58
7: Connect failed
0
 
LVL 11

Expert Comment

by:Sudhakar Pulivarthi
ID: 36599354
hi please check 465 port also,
Check other mail servers:
http://techblissonline.com/gmail-smtp/
0
 

Author Comment

by:mmalik15
ID: 36599403
port 465 did not give an error on telnet but when tried on the we b page I got this error in the exception after few min

"The operation has timed out."
0
 
LVL 33

Assisted Solution

by:Todd Gerbert
Todd Gerbert earned 400 total points
ID: 36599462
C:\Users\MehtabM>telnet smtp.gmail.com 587
Connecting To smtp.gmail.com...Could not open connection to the host, on port 58
7: Connect failed

That's almost certainly a firewall.
0
 

Author Closing Comment

by:mmalik15
ID: 36599500
Thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Read this checklist to learn more about the 15 things you should never include in an email signature.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question