Click here to Skip to main content
15,910,121 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to send email from gmail in C# using smtp server
-----------------------------------

Hi Friends,
Am facing problem while sending email from c# Windows Application.
By the Way am using port 587 and
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");


1) If I run this emailing program by using my laptop. it sends successfully

2) If I Run this program from desktop (Which is connected to Domain) it doesn't send.

I want to run this program in domain machine.

Please can you help me.

Thanks in advance.
Posted
Updated 26-Jul-15 22:29pm
v2
Comments
Wendelius 27-Jul-15 4:06am    
Do you get an error message? If you do, what is it and in which part of the code?
F-ES Sitecore 27-Jul-15 4:15am    
Don't send email via gmail. Ask your network admin which smtp server you can use.
Richard MacCutchan 27-Jul-15 4:45am    
You need to provide some more information; we cannot guess what is happening.
Sreekanth Mothukuru 27-Jul-15 5:49am    
Does your domain server configured to send email using SMTP (on IIS) and if yes are you using localhost (127.0.0.1) or any specific IP address?

1 solution

Based on the description that the program works id not executed from inside your domain, it sounds like you have a firewall preventing the communication. Check that Windows firewall and possible other firewalls let through the communication using port 587.
 
Share this answer
 
Comments
Aravindba 27-Jul-15 4:25am    
5+,yes sometime firewall blocking ,turn off firewall and try
Wendelius 27-Jul-15 5:03am    
Thank you.
Member239258 27-Jul-15 4:26am    
I want to send email through Gmail in domain machine.
Please help.
Member239258 27-Jul-15 4:28am    
Aravindba sir,
Our Firewall is off.
Aravindba 27-Jul-15 4:48am    
use break point and tell what error u get ? and same gmail u use ? working in laptop that same gmail account ?
And in mail message u need to pass smtp,email account,password,ssl,credential.
set ssl and credential true

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900