发送邮件 [英] send mails

查看:238
本文介绍了发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我写了这封代码用于发送邮件但是没有用。

告诉我在等号后应该写什么

SmtpMail.SmtpServer =;


所以邮件存储在/ Inetpub / mailroot / queue&另外我如何通过此代码发送外部邮件。


MailMessage msgmail = new MailMessage();

msgmail.From = txtFrom.Text ;

msgmail.To = txtTo.Text;

msgmail.Subject = txtSubject.Text;

msgmail.Body = txtMessage.Text;

//SmtpMail.SmtpServer =" IP地址"

SmtpMail.SmtpServer =;

//发送消息

SmtpMail.Send(msgmail);

//清除TO,主题,消息字段

txtTo.Text ="" ;;

txtSubject.Text ="";

txtMessage.Text ="" ;;

//显示状态

litStatus.Text = "< p>已发送消息。< / p>" ;;


请尽快回复...........

Hello,

I have written this code for sending mails but is not working.
Tell what should I have to write after the equal sign in
SmtpMail.SmtpServer = ;

so mail to be stored in /Inetpub/mailroot/queue & also how can I send External mails throu this code.


MailMessage msgmail= new MailMessage();
msgmail.From = txtFrom.Text;
msgmail.To = txtTo.Text;
msgmail.Subject = txtSubject.Text;
msgmail.Body =txtMessage.Text;
//SmtpMail.SmtpServer = "IP Address"
SmtpMail.SmtpServer =;
//send message
SmtpMail.Send(msgmail);
//clear TO,Subject,message fields
txtTo.Text="";
txtSubject.Text="";
txtMessage.Text="";
//show status
litStatus.Text ="<p>Message sent.</p>";

Pls reply ASAP...........

推荐答案

这就是你的名字smtp服务器,您需要从主机服务器提供商 - smtp.domain.com格式中找到它。如果他们不提供此服务,您可能会运气不好但请咨询您的ISP。


希望这会有所帮助。
That would be the name of your smtp server, which you will need to find out from host server provider - smtp.domain.com format. If they don''t provide this service, you may be out of luck but check with your ISP.

Hope that this helps.


如果你有一个Gmail帐户,那么你可以使用smtp.gmail.com我没有尝试过其他服务器。但这里需要您的身份验证才能发送邮件。所以也要添加认证码。
if u have a gmail account then u can use "smtp.gmail.com" i have not tried with other servers. but here it requires your authentication for sending mails. so add the authentication codes also to it.


确保你的电子邮件服务器在25号端口......如果不是这样,那你就必须指定如果您的电子邮件服务器需要用户名和密码才能使用它,请查看System.Net.NetworkCredential


我不确定,但是电子邮件服务器与网络服务器在同一台机器上吗?

这些都是你正在开发的计算机上的这些吗?如果是这种情况,您将需要使用localhost。作为您的SMTP服务器。
Make sure that your email server is on port 25...if this isn''t the case, then you''ll have to specify the port.

If your email server requires a user name and password in order to use it, look up System.Net.NetworkCredential

I''m not sure, but is the email server on the same machine as the webserver?
Is are both of these on the computer that you are currently developing on? If this is the case you''ll need to use "localhost" as your SMTPServer.


这篇关于发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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