-3

I created this email address "info@mydomain.com" and I want users be able to send email for me through my website.

Here is my code:

MailMessage mailObject = new MailMessage("a@b.com(this is fake email)", "info@mydomain.com", "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?

Masoud Keshavarz
  • 2,166
  • 9
  • 36
  • 48

3 Answers3

5

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.

Dennis Traub
  • 50,557
  • 7
  • 93
  • 108
1

Mostly the SMTP Server Name should be smtp.mydomain.com

Still it is best to contact the hosting provider

Priyank Patel
  • 6,898
  • 11
  • 58
  • 88
0

enter image description here Open up a command prompt (CMD.exe)

Type nslookup and hit enter
Type set type=MX and hit enter

Type the domain name and hit enter, for example: google.com

The results will be a list of host names that are set up for SMTP

Amit
  • 559
  • 5
  • 8