现在发送来自c#.net的邮件但是我的主要不发送请完成需要 [英] Now send the mail from c#.net but am getting your main not send please do the need ful

查看:81
本文介绍了现在发送来自c#.net的邮件但是我的主要不发送请完成需要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只使用System.Net.Mail写了这个编码

----------------

;



protected void Button1_Click(object sender,EventArgs e)

{

if(txtname.Text.Length< 5)

{

error.Text =请输入你的名字;

}

else if(txtid。 Text.Length< 5)

{

error.Text =请输入您的邮件ID;

}

else if(contact.Text.Length< 5)

{

error.Text =Plase type your contact no;

}

else

{

if(dispay.Text.Length> 100)

{

error.Text =请输入最多100个字符;

}

其他

{

尝试

{

MailMessage Emailmsg = new MailMessage();

Emailmsg.From = new MailAddress(www.qgol.in,plain name);



Emailmsg.To.Add(新邮件地址(jothi.rjk05@yahoo.in,welcome));



Emailmsg.Subject =测试电子邮件表格;





Emailmsg.Body =< html>< body>这是一个测试


测试测试< / body> < / html>;

Emailmsg.IsBodyHtml = true;

Emailmsg.Priority = MailPriority.Normal;

SmtpClient MailClient = new SmtpClient (mail.jothi.rjk05@yahoo.in);

MailClient.Credentials = new System.Net.NetworkCredential(from email address,gud);

MailClient.Send(Emailmsg);



error.Text =您的电子邮件已发送;

}

catch

{

error.Text =你的邮件不发送;

}

I wrote this coding only
----------------
using System.Net.Mail;

protected void Button1_Click(object sender, EventArgs e)
{
if (txtname.Text.Length<5)
{
error.Text = "please type your name";
}
else if (txtid.Text.Length<5)
{
error.Text = "please type your Mail id";
}
else if (contact.Text.Length<5)
{
error.Text = "Plase type your contact no";
}
else
{
if (dispay.Text.Length > 100)
{
error.Text = "Please type upto 100 character";
}
else
{
try
{
MailMessage Emailmsg = new MailMessage();
Emailmsg.From = new MailAddress("www.qgol.in","plain name");

Emailmsg.To.Add (new MailAddress ("jothi.rjk05@yahoo.in","welcome"));

Emailmsg.Subject ="test email form";


Emailmsg.Body = "<html><body>This is a test


Test test</body></html>";
Emailmsg.IsBodyHtml = true;
Emailmsg.Priority = MailPriority.Normal;
SmtpClient MailClient = new SmtpClient("mail.jothi.rjk05@yahoo.in");
MailClient.Credentials = new System.Net.NetworkCredential("from email address","gud");
MailClient.Send(Emailmsg);

error.Text = "Your email was sent";
}
catch
{
error.Text = "your mail not send";
}

推荐答案

将您的正确凭据放在System.Net.NetworkCredential而不是虚拟值...它很多帮助您登录,然后电子邮件就有机会进入!
Put your proper credentials in the System.Net.NetworkCredential instead of dummy values... It might help you to sign in, and then the email stabs a chance of going!


这篇关于现在发送来自c#.net的邮件但是我的主要不发送请完成需要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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