суббота, 22 января 2011 г.

function contactUsMailer(e)

http://www.steegle.com/websites/google-sites-howtos/apps-script-contact-us-form-email
function contactUsMailer(e) {
  //  This script e-mails the contents of a form to a given recipient
  //  The form must have three fields in the order of: name; e-mail address; and message
  //  You must change the recipient variable below to your e-mail address
  try {
    var recipient = "";
    var timestamp = e.values[0];
    var name = e.values[1];
    var email = e.values[2];
    var message = e.values[3];
    var body = name+' <'+email+'> sent the following message: '+message;
    var bodyHTML1 = '<p>'+name+' <a href="mailto:'+email+'">'+email+'</a> sent the following message: </p>';
    var bodyHTML2 = '<blockquote>'+message+'</blockquote>';
    var bodyHTML3 = '<p>Sent by the <a href="http://www.steegle.com/">Steegle.com</a> Contact Us Form Google Apps Script</p>';
    var advancedArgs = {htmlBody:bodyHTML1+bodyHTML2+bodyHTML3 , replyTo:email};
    MailApp.sendEmail(recipient, "Contact Us Form", body, advancedArgs);
  } catch(e){
    MailApp.sendEmail(recipient, "Error - Contact Us Form", e.message);
  }
}


Комментариев нет:

Отправить комментарий