-1

I searched and came across many codes demonstrating mail sending using gmail's smtp with c#

Here is my smtpclient configured to send email.

SmtpClient smtp = new SmtpClient
{
    Host = MailSettings.SMTP, // smtp server address here...
    Port = 465,
    EnableSsl = true,
    DeliveryMethod = SmtpDeliveryMethod.Network,
    Credentials = credentials,
    Timeout = 30000,
    UseDefaultCredentials = false
};

This code works very fine with host as smtp.gmail.com

But when it comes to other Hosts, it fails.

It doesnt send mails.

Can anyone help me with this.

Edi G.
  • 2,432
  • 7
  • 24
  • 33
MARKAND Bhatt
  • 2,428
  • 10
  • 47
  • 80

1 Answers1

0

Can you give more details about the error you are getting? Several things can cause this:

  • Server Configuration: are the ports correct? the server does not require authentication? the server supports ssl?
  • SSL Certificate: the certificate is self-signed? If so you should look here;

Regards,

Community
  • 1
  • 1
jpsfs
  • 708
  • 2
  • 7
  • 24