Debugging adventure - why it's hard to estimate

This is the second instance in recent time where I thought it was a quick fix but ended up taking way more time than it should. The first was an iOS app submission which was something Apple changed recently. This is a perl example so posting it here.

Mandrill is shutting down . I was using their service for my domains table tennis match and Brainturk brain games online . I looked at the alternatives and settled with sparkpost . This is the sparkpost example for using perl . It seems simple enough so I asked my employee who is learning perl to try it out . When we ran the example we started getting an error . This example uses Net::SMTP and running it in debug mode gave us this

RCPT TO: <x@mydomain.com>
550 5.7.1 relaying denied

I started digging into this and as per sparkpost documentation, I had to verify DKIM and SPF records and I had only verified my email so I logged in to their web app and they have the option to copy the text required to validate DKIM it is something like this

scph0416._domainkey.tabletennismatch.com v=DKIM ....

I added this to my DNS and clicked on the verify button on their website, and it would complain that the record was not configured properly. After a lot of tries ( each time I have to wait for DNS to propagate), I figured out that I needed to remove the .tabletennismatch.com from the end.

Finally, I was able to verify the domain and then tried running the script, and the error was still the same. I logged in to their slack channel, but there was no one around at that time, so I logged in a support ticket. They did not seem to have anyone with Perl expertise, finally after around 6 emails, someone wrote that So it looks like some of the perl libraries were trying to use SSLv3 which we don't allow due to the POODLE vulnerability , he was using Net::SMTP::SSL and had manually patched it to use SSL v1 ( he pointed out the line number and the change) and he suggested that I use swaks . I used the swaks command line option, and that worked. I decided to wrap the command line option in the code.

I had forgotten about that, and I asked my employee to add it to our code and he said he had done that and asked me to review the code, I looked at the code and was surprised to find that he had used their example and not swaks wrapper. I mentioned that that example was not working, and he said that the test script he sent me had used the following

 my $mailer = new Net::SMTP(
        'smtp.sparkpostmail.com',
        port => 587,
        Debug => 1);

There was a typo on the port he had used port instead of Port and that was causing this error. I changed it to Port, and it worked. That is enough adventure for me.

Leave a comment

About Kiran

user-pic I blog about Perl.