邮件中的错误 [英] Error in Mail Message
问题描述
大家好,
我曾经用过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"
那可能有助于解决您的问题...
这里有一个通用的电子邮件例程,可以帮助解决其他问题: ^ ]
[edit]一次发布的双引号也显示为奇数字符-在此处替换为双引号,并且可能会导致原始问题的另一个编译问题-OriginalGriff [/edit]
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屋!