I have the following working code to send an email based on the content of one cell. This cell contains the values of other cells to create the email.
The emails send to 2 recipients and it works fine. However, upon receiving the email, the text is wrapped after 74 characters.
Sample sheet replicates issue: https://docs.google.com/spreadsheets/d/1PDSHbrhxiJliTGNx2rlJRAJIrjITADVuGWqTuvpjrgw/edit?usp=sharing
How can i prevent the wrapping? I want the email to send as it appears in the 'body' cell:
=G2&char(10)&E9&char(10)&E10&char(10)&E11&char(10)&E12&char(10)&E13&char(10)&E14&char(10)&E15&char(10)&E16&char(10)&E17&char(10)&E18&char(10)&E19&char(10)&E20&char(10)&E21&char(10)&E22&char(10)&E23&char(10)&E24&char(10)&E25&char(10)&E26&char(10)&E27&char(10)&E28&char(10)&E29&char(10)&E30&char(10)&E31&char(10)
Send email function:
var EMAIL_SENT = 'EMAIL_SENT';
function SendEmailACC() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("EmailACC");
var startRow = 2;
var numRows = 2;
var dataRange = sheet.getRange(startRow, 1, numRows, 6);
var data = dataRange.getValues();
for (var i = 0; i < data.length; ++i) {
var row = data[i];
var emailAddress = row[0]; // First column
var message = row[1]; // Second column
var subject = row[2];
var emailSent = row[5];
var EMAIL_SENT = "Email Processed";
var EMAIL_FAIL = "Email Not Sent";
if (emailSent !== EMAIL_SENT) {
MailApp.sendEmail(emailAddress, subject, message);
sheet.getRange(startRow + i, 5).setValue(EMAIL_SENT);
SpreadsheetApp.flush();
}
}
Utilities.sleep(3000);// pause in the loop
DeleteStatus();
}
How Sample email should look:
Good Morning,
The following claim may have had an incorrect or missing ACC number or was not submitted by the referrer at time of request.
The claim has since been amended or submitted for the release of $50. Updated details are as below.
Vendor ID: ABC123
Invoice number: ABCDE12345
Service Date: 11/10/2019
Patient: John Smith
Service Code(s): COD88
First supplied ACC Number: BTT123
Exam Type: Exam Abc
Amended or updated ACC Number: COD123
Please let me know if any further information is required.
How the email actually comes out:
Good Morning,
The following claim may have had an incorrect or missing ACC number or was
not submitted by the referrer at time of request.
The claim has since been amended or submitted for the release of $50.
Updated details are as below.
Vendor ID: G0A368
Invoice number: ABCDE12345
Service Date: 11/10/2019
Patient: John Smith
Service Code(s): COD88
First supplied ACC Number: BTT123
Exam Type: Exam Abc
Amended or updated ACC Number: COD123
Please let me know if any further information is required.
Any suggestions appreciated