Click here to Skip to main content
15,890,609 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I WORK at ABC Company . and I was assigned to make an application to send an email to employees .
I try browsing and the following code :


C#
public void Send(MailMessage msg)
        {
            SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
            client.EnableSsl = true;
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.Credentials = new NetworkCredential(Username, Password);
            client.Send(msg);
        }


when I run, it does work well . but the email server that I would use is the domain of companies that Rudi_Bastian@abc.com
How do I get my company SmtpClient it ?

may be the master here can help me .


What I have tried:

i dont know what can i do,,,
please help me. because my deadline is closed. help me...
Posted
Updated 7-Sep-16 22:29pm
Comments
Mehdi Gholam 8-Sep-16 1:50am    
Ask your mail admin for the address, port and the enabled protocol.
Karthik_Mahalingam 9-Sep-16 1:27am    
exactly!

1 solution

This isn't really a programming question, more a system admin one. First off don't use gmail to send email

Things you shouldn't spend time doing | The ASP.NET Forums[^]

You need your company sys admin to tell you what company smtp server you can use to send emails through, what port to use (probably 25) and if you need a username\password to access it (probably not). You then adapt the code to match those requirements (eg drop the credential stuff if not needed and change the smtp server and port).
 
Share this answer
 
Comments
bejos3519 8-Sep-16 5:04am    
thanks friend
Karthik_Mahalingam 9-Sep-16 1:27am    
5

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