我正在嘗試發送電子郵件給某人,但我遇到了問題。其實我正在與C#.Net和我的代碼正文在這裏如下:如何將電子郵件發送給其他人
using System.Net;
using System.Net.Mail;
SmtpClient SMTPClientObj = new SmtpClient();
SMTPClientObj.UseDefaultCredentials = false;
SMTPClientObj.Credentials = new NetworkCredential("[email protected]", "Admin password");
SMTPClientObj.Host = "Mail.inno-tech.com";
SMTPClientObj.Port = 587;
SMTPClientObj.EnableSsl = true;
SMTPClientObj.Send("[email protected]", "[email protected]", "test", "this is test")
我面臨「服務器不支持安全連接」的問題。當我使用此代碼
SmtpClient smtpClient = new SmtpClient();
NetworkCredential basicCredential =new NetworkCredential("admin", "admin Password", "Mail.inno - tech.com");
MailMessage message = new MailMessage();
MailAddress fromAddress = new MailAddress("[email protected]");
smtpClient.Host = "Mail.inno-tech.com";
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = basicCredential;
message.From = fromAddress;
message.Subject = "your subject";
message.IsBodyHtml = true;
message.Body = "<h1>your message body</h1>";
message.To.Add("[email protected]");
try
{
smtpClient.Send(message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
我面臨這個問題「郵箱不可用。
看來,[email protected]在無效的主機地址(Mail.inno - tech.com)。事實上,我的問題是我無法從所有郵箱發送郵件到所有其他郵箱。我只需將所有郵箱中的電子郵件發送到對我的主機地址有效的電子郵件地址(Mail.inno - tech.com)。我想知道是否應該將一些設置設置爲配置設置,在此配置設置中,我將Host定義爲接受所有郵件地址作爲接收者,或者有其他解決方案來解決此問題。
提前我很感激你的幫助。
你的問題是什麼?從我可以告訴它聽起來像你的問題是有你的郵件服務器的限制,而不是你的代碼的問題。 – Jason 2011-03-10 21:50:53
我不明白他在問什麼。 – Amy 2011-03-10 22:00:07