Search code examples
c#asp.netemailsmtpsmtpclient

How to find smtp server name


I created this email address "[email protected]" and I want users be able to send email for me through my website.

Here is my code:

MailMessage mailObject = new MailMessage("[email protected](this is fake email)", "[email protected]", "contact us", "Test message");
SmtpClient smtpC = new SmtpClient("smtp server name");
smtpC.Send(mailObject);

Problem is I dont know what to write for smtp server name. How can I find what is my smtp server name?


Solution

  • This is the address of the SMTP server you want to use. e.g. smtp.gmail.com if you're using Gmail.

    Search you email or hosting provider's website for "SMTP". Most likely they will have the details (smtp server name, port, ssl or not) soewhere in the FAQs.