Home > Infopath, JavaScript, SharePoint > How to email data from an InfoPath using JavaScript

How to email data from an InfoPath using JavaScript

There are many ways to send data through email from an Infopath form.
1.) Use Rules to send email in InfoPath
2.) Use an EmailSubmitConnection to send email in InfoPath
3.) Use SPUtility.SendMail to send email in InfoPath
4.) Use System.Net.Mail classes to send email in InfoPath

Here is another way to send data using JavaScript:

function SendEmail(to,cc,bcc,subject,body)
{
	var myOlApp = new ActiveXObject("Outlook.Application");
	newMail = myOlApp.CreateItem(0);
	newMail.To = to;
	newMail.Subject = subject;
	newMail.CC = cc;
	newMail.BCC = bcc;
	newMail.Body = body;
	newMail.Send();
}

The “SendEmail” function takes the following “string” parameters and an example would be:

SendEmail('Balaji@example.com','Baskar@example.com','','Regarding JavaScript Example','A new sourcecode has been posted for sending email using JavaScript. thanks!');
Advertisements
  1. Ram
    March 17, 2011 at 9:46 AM

    Creative and Fabulous!

  2. Leela Vinodhini
    March 24, 2011 at 10:00 PM

    Excellent article, this was the one I was looking for!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: