邮件中的错误 [英] Error in Mail Message

查看:59
本文介绍了邮件中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我曾经用过System.Web.Mail;作为命名空间并出现错误.请解决我的问题,

谢谢
阿努拉格

MailMessage msg = new MailMessage();
msg.From =电子邮件;
msg.To =电子邮件;
msg.Cc =电子邮件;
msg.BodyFormat = MailFormat.Text;
msg.Subject =主题名称"
msg.Body =我的邮件正文"
SmtpMail.SmtpServer =邮件服务器名称";
SmtpMail.Send(msg);

Hi All,

I have used using System.Web.Mail; as Namespace and getting an error. Please sort out my problem,

Thanks
Anurag

MailMessage msg = new MailMessage();
msg.From = Email;
msg.To = Email;
msg.Cc = Email;
msg.BodyFormat = MailFormat.Text;
msg.Subject = "Subject Name"
msg.Body = "My Message Body"
SmtpMail.SmtpServer = "mailservername";
SmtpMail.Send(msg);

推荐答案

个人而言,我会在这些行的末尾添加;":
Personally, I would add a '';'' at the end of these lines:
msg.Subject = "Subject Name"
msg.Body = "My Message Body"


那可能有助于解决您的问题...

这里有一个通用的电子邮件例程,可以帮助解决其他问题:


That might help cure your problem...

There is a generic Email routine here which may help with anything else: Sending an Email in C# with or without attachments: generic routine.[^]


[edit]Once posted the double quotes also showed to be odd characters - replaced here, and may be responsible for another compilation problem with the original question - OriginalGriff[/edit]


这篇关于邮件中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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