iis中的SMTP配置问题 [英] SMTP configuration issue in iis
本文介绍了iis中的SMTP配置问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮我配置指向本地SMTP服务器的SMTP服务器,我的主服务器somewhare。(Ex google,yahoo等...)< br $> b $ b
来自outlook的masseage发送者---->本地SMTP ---> clinet网络(限制访问)---->我的SMTP服务器(第三方托管商) - >邮件接收者。
先谢谢。
Srinivas G
Hi,
Please help me to configure SMTP server pointing to local SMTP server, my main server somewhare.(Ex google,yahoo,etc..)
Masseage sender from outlook ----> Local SMTP ---> clinet network( limited access )----> My SMTP server ( third party hosters)--> mail Receiver.
Thanks in Advance.
Srinivas G
推荐答案
To send emails, use VS 2010 SMTP. You define related parameters in the .config as follows:
<pre><system.net>
<mailSettings>
<smtp from="youremail@yourdomain.com">
<network host="mail.yourdomain.com" port="yourport" userName="youremail@yourdomain.com" password="yourpassword" defaultCredentials="false"/>
</smtp>
</mailSettings>
</system.net>
作为C#代码的示例发送电子邮件:
As an example of the C# code to send emails:
public static void Send(string Subject, string From, string Body, List<emailAddress> CC, MailAddress To, bool BodyHTML)
{
try
{
MailMessage mail = new MailMessage();
if (CC != null)
{
foreach (emailAddress ea in CC)
{
mail.CC.Add(new MailAddress(ea.email, ea.fullname));
}
}
mail.Subject = Subject;
mail.Body = Body;
mail.IsBodyHtml = BodyHTML;
mail.From = new MailAddress(From);
mail.To.Add(To);
SmtpClient client = new SmtpClient();
client.Host = "mail.yourdomain.com";
client.Send(mail);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
这篇关于iis中的SMTP配置问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文