here is a server code example of creating an email. please note that to send an email using this code, i utilize the sendgrid api ... supported as an integration with Apppery.... get an account here : www.sendgrid.com ( $10 a month for 40,000 emails )
var sendURL = "https://api.sendgrid.com/api/mail.sen...";
var apiuser = "yoursendgriduserid";
var apikey = "yoursendgridpassword";
var requestParameters = {
"parameters": {
"subject": "This is a test email",
"text": avariableherewiththecontentofyourmessage,
"from": "Yourauthorizedsnedgridemailaddressonyouraccount",
"to:": "a href="mailto:sendtoaddress@somedomain.com" rel="nofollow"sendtoaddress@somedomain.com/a",
"api_user": apiuser,
"api_key": apikey
}
};
Code: Select all
try { // sending the api call
var XHRResponse = XHR.send("POST", sendURL, requestParameters);
response.success(XHRResponse);
responseBody.emailsSent = ncounter + 1;
console.log('emails sent:' + parseInt(ncounter + 1));
// console.log('successful email to :' + strIngvarwiththtetoaddress );
} catch (e) {
console.log('there was an error in the mail send API call: ' + e.message + ' Error ncode was:' + e.code);
} // end sending the api call catch
please note... be sure to have server code where you have logged in and set up respondbody etc prior to inserting this code and customizing for your use..