How can we send mail using JavaScript?

Answer Posted / $lv@ganapathy.k

You can send via Using asp.net.
Use the following Assembly System.Web.Mail;

// Instantiate a new instance of MailMessage
MailMessage mMailMessage = new MailMessage();

// Set the sender address of the mail message
mMailMessage.From = new MailAddress(from);
// Set the recepient address of the mail message
mMailMessage.To.Add(new MailAddress(to));
// Check if the bcc value is null or an empty string
if ((bcc != null) && (bcc != string.Empty))
{
// Set the Bcc address of the mail message
mMailMessage.Bcc.Add(new MailAddress(bcc));
}

// Check if the cc value is null or an empty value
if ((cc != null) && (cc != string.Empty))
{
// Set the CC address of the mail message
mMailMessage.CC.Add(new MailAddress(cc));
} // Set the subject of the mail message
mMailMessage.Subject = subject;
// Set the body of the mail message
mMailMessage.Body = body;
// Set the format of the mail message body as HTML
mMailMessage.IsBodyHtml = true;
// Set the priority of the mail message to normal
mMailMessage.Priority = MailPriority.Normal;

// Instantiate a new instance of SmtpClient
SmtpClient mSmtpClient = new SmtpClient();
// Send the mail message
mSmtpClient.Send(mMailMessage);

Try to read Proxy address,username and password from
web.config file.

Is This Answer Correct ?    17 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the functionality of the functions strstr() and stristr()?

610


What is the correct syntax of mail() function in php?

654


Is php required for wordpress?

599


Declare a new variable in php equal to the number 3;

597


What are variables in research examples?

662






What are the string functions in php?

605


in PHP for pdf which library used?

642


Does php need apache?

583


What is the difference between htmlentities and htmlspecialchars in php?

577


How to create a session? How to set a value in session?

609


Tell me what is the difference between exception::getmessage and exception::getline?

581


What is a php web application?

587


How can we check the value of a given variable is alphanumeric?

622


What is urlencode and urldecode in php?

665


Difference between $message vs. $$Message in php.

661