邮件发送asp.net C#脚本 [英] mail sending asp.net c# script

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

问题描述

//Name Space:
using System.Web.Mail;

//Btn click:

MailMessage mail = new MailMessage();
mail.To = "user@gmail.com";
mail.From = "admin@admin.com";
mail.Subject = "Confirmation";
mail.Body = "Acoount confirmed....................";
SmtpMail.SmtpServer = "1:1:2:1";

try
{
  SmtpMail.Send(mail);
  Response.Write("Mail send successfully");
}
catch (Exception ex)
{
  Response.Write("sending failure:  "+ex.Message);
}


我写了这段代码,用asp.net c#脚本发送邮件.但是发生了错误.
错误是:

传输无法连接到服务器

此错误的原因是什么?我不明白此错误的正确问题是什么


I wrote this code for sending mail in asp.net c# script. But an error has occured.
error is:

The transport failed to connect to the server

What is the reason for this error? I don''t understand what is the correct problem of this error

推荐答案

您是否注意到:这不是有效地址:"1:1:2:1 ?
Did you notice: this is not a valid address: "1:1:2:1"?


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

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