smpt client for windows 7

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?
mmalik15Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Sudhakar PulivarthiConnect With a Mentor Project Lead - EngineeringCommented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
mmalik15Author Commented:
Sorry I am using windows 7 professional sp1 and checked windows features already and it does not have smtp client option
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Paul MacDonaldDirector, Information SystemsCommented:
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
 
mmalik15Author Commented:
I have tried connecting to "clinmed.gla.ac.uk" but the exception i get is "Unable to connect to the remote server".
0
 
Paul MacDonaldDirector, Information SystemsCommented:
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
 
Sudhakar PulivarthiProject Lead - EngineeringCommented:
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
 
mmalik15Author Commented:
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
 
mmalik15Author Commented:
I have also tried with port 587. And did try clinmed using port 25 and 587 but could not connect
0
 
Sudhakar PulivarthiProject Lead - EngineeringCommented:
Please turn off firewall and check... antivirus might be blocking..
please turn them off and check once...
0
 
mmalik15Author Commented:
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
 
Sudhakar PulivarthiProject Lead - EngineeringCommented:
hi please check 465 port also,
Check other mail servers:
http://techblissonline.com/gmail-smtp/
0
 
mmalik15Author Commented:
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
 
Todd GerbertConnect With a Mentor IT ConsultantCommented:
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
 
mmalik15Author Commented:
Thanks
0
All Courses

From novice to tech pro — start learning today.