go-gomail / gomail

The best way to send emails in Go.
MIT License
4.3k stars 570 forks source link

Base64-encoded attachs have line length of 78 bytes and marked as spam #124

Open siritinga opened 5 years ago

siritinga commented 5 years ago

Hi!

I'm having an issue of mails sent using gomail.v1 in linux being marked as spam.

I've send an email with an attachment to https://www.mail-tester.com to evaluate the issue and the most worrisome problems are as follows:

-2.636 | BASE64_LENGTH_78_79 | BASE64_LENGTH_78_79

-2.019 | BASE64_LENGTH_79_INF | base64 encoded email part uses line length greater than 79 characters

I get a -4.6 score just because of this, which almost mark is as spam (but I have some other issues so I get a -5.8 score, definitively spam).

The SpamAssasin info about this issue is: https://wiki.apache.org/spamassassin/Rules/BASE64_LENGTH_78_79

Checking the produced base64 text, I see that it's 78 characters long. In addition, the carriage return is CRLF, so line length is 80 characters.


JVBERi0xLjUNCiW1tbW1DQoxIDAgb2JqDQo8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFIvTGFuZy
hlcy1FUykgL1N0cnVjdFRyZWVSb290IDY2IDAgUi9NYXJrSW5mbzw8L01hcmtlZCB0cnVlPj4+Pg0K
ZW5kb2JqDQoyIDAgb2JqDQo8PC9UeXBlL1BhZ2VzL0NvdW50IDYvS2lkc1sgMyAwIFIgMTQgMCBSID
QwIDAgUiA0NSAwIFIgNTEgMCBSIDYyIDAgUl0gPj4NCmVuZG9iag0KMyAwIG9iag0KPDwvVHlwZS9Q

I see no way to reduce generated line length.

Is something I can do to avoid this?

Thanks for your help.

pedromorgan commented 5 years ago

see #104 and #108