1

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?

Hilmi
  • 3,411
  • 6
  • 27
  • 55
  • 1
    It would be a lot more helpful to post this as text vs. inline images that can't be expanded or viewed. – Joe Apr 06 '14 at 11:56
  • @Joe I updated the question as you requested, thanks for your note. – Hilmi Apr 06 '14 at 12:06
  • possible duplicate of [How to send a csv attachment with lines longer than 990 characters?](http://stackoverflow.com/questions/10401863/how-to-send-a-csv-attachment-with-lines-longer-than-990-characters) – Joe Apr 06 '14 at 12:16
  • Your exact problem (with SendGrid) covered in the linked question. – Joe Apr 06 '14 at 12:16
  • @Joe, Here, we create the emails manually, we manually add the content boundary and the encodings/content types, what I've tried is to encode the csv content with base-64 and Content-type => application/octet-stream and the ;charset => base-64 but yet its not working, now the email's attachment is encoded and the csv file is also encoded. do you have any other hints that could help, I really appreciate your help Sir, Thanks alot – Hilmi Apr 06 '14 at 13:05

1 Answers1

0

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

Community
  • 1
  • 1
Hilmi
  • 3,411
  • 6
  • 27
  • 55