Question

We used to use our own SMTP servers for sending emails, recently we started migrating some of our emails to be sent through SendGrid, everything is working smoothly except that the email's content gets breaked into new lines after some extent

please check this email with breaked content

--BAYT_2660.59000399_BAYT
Content-type: application/octet-stream
Content-Disposition:attachment; filename="CV_report.xls"

date created,CV ID,First Name,Middle Name,Last Name,User Name,,home
 phone,work phone,Mobile Phone,Email Address,Nationality,Country,City,P. O.
 Box,Address (Line 1),Address (Line 2),Gender,Residence Location,Notice
 Period,Last Monthly Salary,Education Degree,Education Location,educational
 institution,completion date of education,education description,work
 experience from date,work experience to date,work experience job
 title,work experience company name,work experience description,work
 experience location,work experience job role,work experience company
 industry,skill name,skill level,skills years of experience,skills last
 used,language name,language level
2008-06-17,3959854,t12345,mars,t12345,t12345,1986-11-11,12-12-12,12-12-12,12-12-12,test_xx@bayt.net,Bahrain,Belgium,,,,,,Belgium,Immediately,0,High
 school or equivalent,,,,,,,,,,,Technology/IT,Information Technology,,,,,,

and this is from the old our smtp servers.

--BAYT_-142109.046263_BAYT
Content-type: application/octet-stream
Content-Disposition:attachment; filename="CV_report.xls"

date created,CV ID,First Name,Middle Name,Last Name,User Name,,home phone,work phone,Mobile Phone,Email Address,Nationality,Country,City,P. O. Box,Address (Line 1),Address (Line 2),Gender,Residence Location,Notice Period,Last Monthly Salary,Education Degree,Education Location,educational institution,completion date of education,education description,work experience from date,work experience to date,work experience job title,work experience company name,work experience description,work experience location,work experience job role,work experience company industry,skill name,skill level,skills years of experience,skills last used,language name,language level
2008-06-17,3959854,t12345,mars,t12345,t12345,1986-11-11,12-12-12,12-12-12,12-12-12,test_xx@bayt.net,Bahrain,Belgium,,,,,,Belgium,Immediately,0,High school or equivalent,,,,,,,,,,,Technology/IT,Information Technology,,,,,,

the line breaks are having huge effects if the email contained csv file as an attachment like the images I showed, "home phone" is a single value that was breaked into two lines with Sendgrid SMTP server, is there any idea or hint on what caused the line breaks?

Was it helpful?

Solution

Found My answer in this question

How to send a csv attachment with lines longer than 990 characters

I had to encode the csv content with base64 and add the content-transfer-encoding: base64 header

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top