|
|
|
|
|
by AlexITC
983 days ago
|
|
There was a time I had a tricky bug to solve, a important email wasn't being delivered to customers, I had to do this to discover the 1-line change: 1. Simulate the email and check whether it was being received by the mail provider (Gmail), turns out that it was received by Google but Google spam filters rejected the email, we could see the sender/subject but we couldn't see the content. 2. Print the email content in the code just before sending it, all seem correct here. 3. Do monkey-patching to a Ruby library that was in charge of sending the email to the SNTP server, println says that we are sending the right data. 4. Capture the traffic (Wireshark) sent by the app to the SMTP server just to make sure we are sending what needs to be sent, turns out that the email content wasn't what I expected, it was something like a Ruby object's default hash + some weird characters. Apparently, the library in use wasn't working with the object we were sending, which caused the email content to become a random string, this triggered Google spam filters causing it to reject the email, the solution was as simple as changing a line from `email.body` to `email.body.string`. |
|