在asp.net中使用smtp发送sendind邮件 [英] sendind mail using smtp in asp.net

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

问题描述

在我的asp.net应用程序中,我想发送邮件.

它在一台服务器(域)中当前正在工作,但是无法更改(域)服务器,为什么会出现此问题?
对于不同的服务器或域,smtp是否有所不同?

我的代码是

In my asp.net application I want to send mail.

it was working currently in one server (domain), but it is not working change the (domain) server why this problem?
Is smtp different for different server or domain?

My code is

DataSet ds = new DataSet();
            MailMessage mail1 = new MailMessage();
            mail1.From = txtemail.Text;
            ds.ReadXml(Server.MapPath("~/Admin/xml/feedbackmail.xml"));
            mail1.To = ds.Tables[0].Rows[0][0].ToString();

            mail1.Body = "Sender : " + txtemail.Text + "\n" + "Name : " + txtname.Text + "\n" + "Phone : " + txtPhone.Text + "\n" + "\n" + "Sub:" + txtsubject.Text + "\n" + "Body :" + txtmsg.Text;
            SmtpMail.SmtpServer.Insert(0, "83.245.63.194");
            SmtpMail.Send(mail1);



我的问题是,SmtpMail.SmtpServer.Insert(0, "83.245.63.194")是否针对不同的服务器或站点或域而不同.


我的错误是"SendUsing"配置值无效.



My question is, is SmtpMail.SmtpServer.Insert(0, "83.245.63.194") different for different server or site or domain.


My error is The "SendUsing" configuration value is invalid.

推荐答案

检查您的SMTP IP地址是否可从新的域/服务器访问.
在新服务器的命令提示符中运行" ping 83.245.63.194 "命令.
Check your SMTP IP-Address is accessible from your new Domain/Server.

Run "ping 83.245.63.194" command from command-prompt of your new Server.


System.Net.Mail.MailMessage obj = new System.Net.Mail.MailMessage();
       
 
     SmtpClient serverobj = new SmtpClient();
            serverobj.Credentials = new NetworkCredential("anilmeets4u@gmail.com", "yourpassword");
            serverobj.Port = 587;
            serverobj.Host = "smtp.gmail.com";
            serverobj.EnableSsl = false;
            obj = new System.Net.Mail.MailMessage();
            obj.From = new MailAddress("YourEmailId", "Google.com", System.Text.Encoding.UTF8);
            obj.To.Add(ASPxtxtToUser.Text);
            obj.CC.Add(ASPxTexttoCc.Text);
            obj.Priority = System.Net.Mail.MailPriority.High;
            obj.Subject = txtSubject.Text;
            string date = DateTime.Now.ToString();
            obj.Body = ASPxMemo1.Text;
            serverobj.Send(obj);
            lblsend.Text = "Your Message Send Sucessfully";



其作品


问候,

Anilkumar.D



Its Works


Regards,

Anilkumar.D


检查此

如何通过asp.net发送电子邮件 [ ^ ]
Check this

How to send email through asp.net[^]


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

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