Regardin Mail Issue请立即反馈 [英] Regardin Mail Issue please immediate feed back

查看:87
本文介绍了Regardin Mail Issue请立即反馈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的邮件代码在下面提到!!!

My mail code is given below mention here !!!

var from = gmail_usertxt.Text;
var to = sendermailtxt.Text;
string password = passwordtxt.Text;
string Subject = subjectext.Text;
string body = "Hello" + idlbl.Text + "\n" + "Your "+select_exam.SelectedValue+" Exam will be conducted on " + datepick.Text;

var smtp = new SmtpClient();
{
    smtp.Host = "smtp.gmail.com";
    smtp.Port = 587;
    smtp.EnableSsl = true;
    smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
    //----- Credentials
    smtp.UseDefaultCredentials = false;
    smtp.Credentials = new NetworkCredential(from, to);
    smtp.Timeout = 1000000;
}
string full_name = idlbl.Text;
string[] f = full_name.Split(' ');
string fname = f[0];
string lname=f[1];
string date = datepick.Text;
string[] d = date.Split('/');
string day = d[1];
string month = d[0];
string year = d[2];
string comp_date = year + "/" + month + "/" + day;
int id = (int)Session["Student_id"];
int i = db.update_examdate(id,comp_date,select_exam.SelectedValue);

smtp.Send(from, to, Subject, body);
if (i == 1)
{
    errlbl.Text = "Mail is send";
}
}
catch (Exception ex)
{
errlbl.Text = "server problem";
}
Session["Email"] = null;





我的webconfig设置如下所示!!!



And my webconfig setting is is given below mention here !!!

<configuration>
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="Network">
        <network host="smtp.gmail.com" port="587" userName="kuldeepsingh.ks2105@gmail.com" password="techsupport" />
      </smtp>
    </mailSettings>
  </system.net>
  <appSettings>
    <add key="Email" value="bankpaper.in"/>
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5"/>
  </system.web>
</configuration>

推荐答案

首先:



For a start:

var smtp = new SmtpClient();
{
    smtp.Host = "smtp.gmail.com";
    smtp.Port = 587;
    smtp.EnableSsl = true;
    smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
    //----- Credentials
    smtp.UseDefaultCredentials = false;
    smtp.Credentials = new NetworkCredential(from, to);
    smtp.Timeout = 1000000;
}







这不会编译。如果您的代码不能编译,那么您需要阅读错误消息并按照他们的说法进行操作。如果您无法理解它们,您需要询问实际问题(不要进行代码转储)并向我们提供错误消息,当问题是基本问题时,可能更难发现,因为问题会模糊不清。 />


它不会编译,因为;应该在块设置参数值之后,我认为()不应该在那里。



一般来说,阅读一本关于编程基础知识的书,请记住,如果你向我们寻求免费帮助,你就不能设定时间表。




This won''t compile. If your code won''t compile, then you need to read the error messages and do what they say. If you can''t understand them, you need to ask actual questions ( not do code dumps ) and give us the error message, when the problem is this basic, it can be harder to spot because the questions will be vague.

It won''t compile because the ; should be AFTER the block setting parameter values, and I think the () should not be there at all.

In general, read a book on the basics of programming, and remember, if you ask us for free help, you don''t get to set a time line.


这篇关于Regardin Mail Issue请立即反馈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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