How to send mail using company domain name???
For eg., [email protected] to [email protected]
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
venkata kumarPosted Feb 8, 2013, 6:39 AM
check fallowing
try{
string enableEmail = getValueFromList("EnableEmail").Trim();
if (enableEmail != null)
{
if ((enableEmail.ToString().Trim().ToUpper() != "T")
&&
(enableEmail.ToString().Trim().ToUpper() != "TRUE"))
{
return "Email sending is not enabled";
}
}
MailMessage msg = new MailMessage();
msg.From = new MailAddress("[email protected]");
msg.To.Add("[email protected]");
msg.Body = "Testing the automatic mail";
msg.IsBodyHtml = true;
msg.Subject = "Movie Data";
SmtpClient smt = new SmtpClient("web mail url like gmail (smtp.gmail.com)");
smt.Port = 587;
smt.Credentials = new NetworkCredential("[email protected]", "pasword");
smt.EnableSsl = true;
smt.Send(msg);
string script = "";
this.ClientScript.RegisterClientScriptBlock(this.GetType(), "sendMail", script);
//return "Success";
}
catch (Exception ex)
{
throw ex;
}