如何根据域名指定端口......................................... .............. [英] How to specify the port according to domain name.......................................................

查看:313
本文介绍了如何根据域名指定端口......................................... ..............的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public void Sendmail(string uemail)
    {

MailMessage loginInfo = new MailMessage();
        loginInfo.To.Add(uemail);
        loginInfo.From = new MailAddress("zzz@gmail.com");
        loginInfo.Subject = "Forgot Password Information";

        loginInfo.Body = "Username: " + dspwd.Tables[0].Rows[0]["Username"] + "<br><br>Password: " + dspwd.Tables[0].Rows[0]["user_password"] + "<br><br>";
        loginInfo.IsBodyHtml = true;
        SmtpClient smtp = new SmtpClient();
        smtp.Host = "smtp.gmail.com";
        smtp.Port = 587;
        smtp.EnableSsl = true;
        smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
        smtp.UseDefaultCredentials = false;
       smtp.Credentials = new System.Net.NetworkCredential("xyz@gmail.com","*******");
        smtp.Send(loginInfo);
}


推荐答案

使用此代码
use This Code
MyMsg = New MailMessage(StrFrom, StrTo, StrSubject, StrBody);
MyMsg.IsBodyHtml = True;
MySmtp = New SmtpClient("localhost");
MySmtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
MySmtp.Send(MyMsg);


不要使用端口名或使用端口50


dont use port name or use port 50


点击此链接

http://en.allexperts.com/q/Active- Server-Pages-1452/Save-asp-form-pdf.htm [
Click this link

http://en.allexperts.com/q/Active-Server-Pages-1452/Save-asp-form-pdf.htm[^]

i hope this link really help u..

Regard
Sham
:)


HI

以下是默认的电子邮件端口:


HI

Here are the default email ports for:


if (EmailId.Contains("gmail"))
{
server = "smtp.gmail.com";
port = "465";
}
else if (EmailId.Contains("yahoo"))
{
server = "smtp.mail.yahoo.com";
port = "465";
}
else if (EmailId.Contains("hotmail"))
{
server = "smtp.live.com";
port = "25";
}
else if (EmailId.Contains("aol"))
{
server = "smtp.aol.com";
port = "465";
}


这篇关于如何根据域名指定端口......................................... ..............的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆