基本的なメールをフォルダーに送信しようとしていますが、メールを受信しても本文が完全に欠落しています。
private void MailReport()
{
string to = "arianul@gmail.com";
string From = "ArianG@lr.co.za";
string subject = "Report";
**string Body = "Dear sir ,<br> Plz Check d Attachment <br><br>";**
bool send = sendMail(to, From, subject, Body);
if (send == true)
{
string CloseWindow = "alert('Mail Sent Successfully!');";
ClientScript.RegisterStartupScript(this.GetType(), "CloseWindow", CloseWindow, true);
}
else
{
string CloseWindow = "alert('Problem in Sending mail...try later!');";
ClientScript.RegisterStartupScript(this.GetType(), "CloseWindow", CloseWindow, true);
}
}
public bool sendMail(string to, string from, string subject, string body)
{
bool k = false;
try
{
MailMessage msg = new MailMessage(from, to);
msg.Subject = subject;
AlternateView view;
SmtpClient client;
StringBuilder msgText = new StringBuilder();
view = AlternateView.CreateAlternateViewFromString(msgText.ToString(), null, "text/html");
msg.AlternateViews.Add(view);
msgText.Append("<body><br></body></html> <br><br><br> " + body);
client = new SmtpClient();
client.Host = "staging.itmaniax.co.za";
client.Send(msg);
k = true;
}
catch (Exception exe)
{
Console.WriteLine(exe.ToString());
}
return k;
}
<system.net>
<mailSettings >
<smtp deliveryMethod="specifiedPickupDirectory" from="ArianG@lr.co.za">
<network host="staging.itmaniax.co.za"/>
<specifiedPickupDirectory pickupDirectoryLocation="C:\testdump\emaildump\"/>
</smtp>
</mailSettings>
Visual Studio-2008で行われているように、問題は本体とhtmlにあると感じています。おそらくアドバイスはありますか?