How Can I send Email to others
I'm trying to send and Email to somebody, but I faced to problem. Actually I'm working with C# .Net and my code body is here as follows:
using System.Net;
using System.Net.Mail;
SmtpClient SMTPClientObj = new SmtpClient();
SMTPClientObj.UseDefaultCredentials = false;
SMTPClientObj.Credentials = new NetworkCredential("admin@Domain.com", "Admin password");
SMTPClientObj.Host = "Mail.inno-tech.com";
SMTPClientObj.Port = 587;
SMTPClientObj.EnableSsl = true;
SMTPClientObj.Send("admin@Domain.com", "somebodyEmail@yahoo.com", "test", "this is test")
I faced to "Server does not support secure connections" problem. when I used this code
SmtpClient smtpClient = new SmtpClient();
NetworkCredential basicCredential =new NetworkCredential("admin", "admin Password", "Mail.inno - tech.com");
MailMessage message = new MailMessage();
MailAddress fromAddress = new MailAddress("sam@yahoo.com");
smtpClient.Host = "Mail.inno-tech.com";
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = b开发者_C百科asicCredential;
message.From = fromAddress;
message.Subject = "your subject";
message.IsBodyHtml = true;
message.Body = "<h1>your message body</h1>";
message.To.Add("David@gmail.com");
try
{
smtpClient.Send(message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
I faced to this problem "Mailbox unavailable. The server response was: No such user here" .
It seems that David@gmail.com in not valid for Host address(Mail.inno - tech.com). As a matter of fact, my problem is I can not send an Email from all mail boxes to all any other mail boxes. I just can send an Email from all mail boxes to Email addresses which are valid for my host address(Mail.inno - tech.com). I wonder whether I should set some setting as a configuration setting in which I define for Host to accept all mail addresses as a receiver or there is other solution to solve it.
In advance I really appreciate you for your help.
Well, it seems that your mail is being sent out properly, the problem probably lies in configuration of SMTP server. If you're into fixing it, you should enable mail relay (at least for mail sent from your host, for example).
So technically it's a "contact your SMTP server administrator" problem :) If you're the administrator, then do what admins do (consider the documentation).
(BTW. I just realized that if the e-mail David@gmail.com does not exist (is misspelled or mis-CaSed), the response you're getting is correct and there's no other problem to solve)
精彩评论