配置电子邮件服务器时出错 [英] error in configuring email server

查看:91
本文介绍了配置电子邮件服务器时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用smtp配置电子邮件,我得到的异常是事务失败。服务器响应是:m1pismtp01-025.prod.mesa1.secureserver.net。我的smtp主机和端口号是否正确。如果需要任何设置请在webconfig文件中向我建议。



尝试

{

if(!string.IsNullOrEmpty(header) )&&!string.IsNullOrEmpty(subject)&&!string.IsNullOrEmpty(messageBody))

{

System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();



using(System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient())

{

msg.Subject = subject;

msg.Body =< html>< body> +

姓名:+ context.Request [姓名] +

+

电子邮件:+ context.Request [email] +

消息:+ context.Request [message];

msg.From = new System.Net.Mail.MailAddress(hello@XXX.in, XXX询问);

msg.To.Add(hello@XXX.in);

msg.IsBodyHtml = true;

smtp.Host =smtp.xxx.in;

System.Net.NetworkCredential basicauthenticationinfo = new System.Net.NetworkCredential(hello@XXX.in,pwd);

smtp.Port = int.Parse(25);

smtp.EnableSsl = true;

smtp.UseDefaultCredentials = false;

smtp.Credentials = basicauthenticationinfo;

smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;



smtp。发送(msg);

isvalid = true;

}

}

}

解决方案

让我们看看...... int.Parse(25); ...你认真吗?



这是我最好的建议:你应该停止做你正在做的事情并从基础开始学习编程:对象和类型,变量和表达式,方法及其参数。避免开发任何复杂的东西:没有UI,除了简单的仅控制台应用程序,没有网络,没有什你还没准备好。



这真的很严重。如果你不遵循我的建议,除了很大的挫折和严重的时间损失之外,你什么都得不到。



-SA

i configure email using smtp and i am getting exception that "Transaction failed. The server response was: m1pismtp01-025.prod.mesa1.secureserver.net" .is my smtp host and port no are correct.if any settings required in webconfig file suggest to me please.

try
{
if (!string.IsNullOrEmpty(headers) && !string.IsNullOrEmpty(subject) && !string.IsNullOrEmpty(messageBody))
{
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();

using (System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient())
{
msg.Subject = subject;
msg.Body = "<html><body>" + "

Name :" + context.Request["Name"] + "

" + "

Email :" + context.Request["email"] + "

Message :" + context.Request["message"];
msg.From = new System.Net.Mail.MailAddress("hello@XXX.in", "XXX enquiry");
msg.To.Add("hello@XXX.in");
msg.IsBodyHtml = true;
smtp.Host = "smtp.xxx.in";
System.Net.NetworkCredential basicauthenticationinfo = new System.Net.NetworkCredential("hello@XXX.in", "pwd");
smtp.Port = int.Parse("25");
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = basicauthenticationinfo;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;

smtp.Send(msg);
isvalid = true;
}
}
}

解决方案

Let's see… int.Parse("25");… are you serious?

Here is my best advice: you should stop doing what you are doing and start learning programming starting from the very basics: object and types, variable and expression, methods and their parameters. Avoid developing anything complex: no UI except simple console-only applications, no networks, nothing cool. You are not ready yet.

This is really serious. If you are not going to follow my advice, you won't get anything except big frustration and gross loss of time.

—SA


这篇关于配置电子邮件服务器时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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