关于邮件传递系统 [英] about mail delivery system
本文介绍了关于邮件传递系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
实际上,我会在文本框中输入邮件ID,但不会发送.我不知道为什么未发送.任何机构都可以帮助我
actually i will give mail id in my text box but its not sending.i don''t know why its not sended.can any body help me
try
{
//textbox3.text is we can give mail id in that
MailAddress mailfrom = new MailAddress("TextBox3.Text");
MailAddress mailto = new MailAddress("sankarreddyece@gmail.com");
MailMessage newmsg = new MailMessage(mailfrom, mailto);
newmsg.Subject = "Subject of Email";
newmsg.Body = "Body(message) of email";
////For File Attachment, more file can also be attached
//Attachment att = new Attachment ( "G:\\code.txt" );
//newmsg.Attachments.Add ( att );
SmtpClient smtps = new SmtpClient("smtp.gmail.com", 587);
smtps.UseDefaultCredentials = false;
smtps.Credentials = new System.Net.NetworkCredential("sankarreddyece@gmail.com", "640");
smtps.EnableSsl = true;
smtps.Send(newmsg);
//MessageBox.Show("mail Send");
}
catch (Exception ex)
{
//MessageBox.Show(ex.ToString());
}
推荐答案
好吧,这是VS2010附带的这个工具-称为调试器.如果使用它,您将发现异常.顺便说一句,您在catch
块中注释掉的代码应为:
Well, there;''s this tool that comes with VS2010 - it''s called a debugger. If you use it, you''ll discover the exception. And by the way, the code you have commented out in yourcatch
block should be this:
MessageBox.Show(ex.Message);
这篇关于关于邮件传递系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文