Link to home
Start Free TrialLog in
Avatar of mmalik15
mmalik15

asked on

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?
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

run your windows setup (add remove programs from the control panel), there is a SMTP installation (part of IIS if I am not mistaken)
Avatar of mmalik15
mmalik15

ASKER

Sorry I am using windows 7 professional sp1 and checked windows features already and it does not have smtp client option
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?
I have tried connecting to "clinmed.gla.ac.uk" but the exception i get is "Unable to connect to the remote server".
ASKER CERTIFIED SOLUTION
Avatar of Sudhakar Pulivarthi
Sudhakar Pulivarthi
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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

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.
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"}"
I have also tried with port 587. And did try clinmed using port 25 and 587 but could not connect
Please turn off firewall and check... antivirus might be blocking..
please turn them off and check once...
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
hi please check 465 port also,
Check other mail servers:
http://techblissonline.com/gmail-smtp/
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."
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks