forms - Error while trying to use the "reply-to" in google apps script -
I am using Google Apps Script to get a specific form response in a particular e-mail, / P>
What am I trying to do that uses a Google form to open a support ticket, so people need to fill in certain fields such as title, description and e-mail,
And when they submit the form, it will automatically open a ticket, but e-mail us The owner of the form will be from the form, and it was a problem because we want the person who opened the ticket to receive an email update, so what I am trying to do is:
I asked a field In the email form, put in the form, and I am trying to put that e-mail in the answer ...
And apparently I have the right way to catch that e-mail But the answer is not shown to the email that Gon filled the box, it appears an error: [Ljava.lang.Object; @ 34dfe075
Can anyone help me?
This is my script:
Start the function () {var triggers = ScriptApp.getProjec tTriggers (); (Trigger in var i) {ScriptApp.deleteTrigger (trigger [i]); } ScriptApp.newTrigger ("SendGoogleForm") .for spreadsheet (SpreadsheetAP.Active Spreadsheet ()) .onFormSubmit () .create (); } SendGoogleForm (e) function {try {var email = "support@email.com"; Var form = E. Named Value; Var topic = form ["title"]; Var s = Spreadsheet App.getActiveSheet (); Var column = s.getRange (1,1,1, s.getLastColumn ()). GetValues () [0]; Var message = ""; (Different keys in the column) {var key = columns [keys]; If (E. Named Value [Key] & (EK Named Value [Key]! = "")) {Message + = key + '::' + e.namedValues [key] + "\ N \ n "; }} GmailApp.sendEmail (email, subject, message, {responseTo: form ["e-mail"], from: "support@email.com"}); } Hold (e) {logger.log (e.toString ()); }}
And here's its Outlook:
to: support@email.com Reply-To: [Ljava.lang.Object; @ 34dfe075 to: support@email.com Date: Fri, October 17, 2014 10:55 AM Subject: New Test
The answer is broken: (
e.namedValues properties are returned in the values array, so you have to access them.
Modify your sendmail email as follows:
GmailApp.sendEmail (email, subject, message, {replyTo: form ["e-mail"] [0], from: "support @ email .com "[});
Note [0] array [[]] on the form [" e-mail "] field, note this It seems that you want the first value in that array, which is the email address entered.
See examples next to "e.namedvalues":
Comments
Post a Comment