I have a code,
System.Web.Mail.MailMessage oMailMessage = new MailMessage();
oMailMessage.From = strFromEmaild;
oMailMessage.To = strToEmailId;
oMailMessage.Subject = strSubject;
oMailMessage.Body = strBody;
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send(oMailMessage);
(all variables have values)
I installed virtual SMTP services. why can't he send emails. why doesn't it work?
EDIT
public bool SendMail(string strToEmailId, string strFromEmaild, string strSubject, string strBody)
{
try
{
System.Web.Mail.MailMessage oMailMessage = new MailMessage();
oMailMessage.From = strFromEmaild;
oMailMessage.To = strToEmailId;
oMailMessage.Subject = strSubject;
oMailMessage.Body = strBody;
SmtpMail.SmtpServer = "SERVERNAME";
SmtpMail.Send(oMailMessage);
return true;
}
catch (Exception ex)
{
return false;
}
}
I have this code. It does a fine and returns true, but I do not receive any mail in the inbox.
What else could be wrong?
Receiving some letters in the BadMail Dir folder in the C: \ Inetpub \ mailroot \ Badmail folder also in the Queue folder, where there are some letters ... what does this mean .. ??
I found that mail can only be sent to gmail accounts ... why is this?
source
share