Sendmail on Ubuntu sending multiple blank emails without me triggering them

December 6, 2017 1.1k views

My goal was to create a simple text--> email mechaism using twilio. I installed a LEMP stack including sendmail onto an Ubuntu server.

I got the thing working--I can text my twilio number and get it in my inbox!--but, unfortunately, I also get tons of blank emails from my own site (it has no content--literally used just for the purposes of this text to email configuration).

These emails aren't being triggered via twilio, per my twilio dashboard, so I assume there's something weird happening with sendmail.

Any ideas what could be triggering these emails to fire out of the blue? I have like zero security--could that be it? What should I install to fix it?

1 Answer

Probably a cronjob is doing it. Post the full body of such a mail (including headers).

  • Thanks for your reply. This project was put on hold but I'm back at it.

    I think everytime a person/crawler visits my page, a blank email is being sent.

    I think I could probably write some kind of "if" statement to ensure that emails get set only when twilio/SMS triggers a visit.

    I'm just not sure what won't break it or what to write? if you have suggestions that would be awesome.

    The php snippet I'm using (from twilio) is:

    header('Content-type: text/xml');
    echo '<?xml version="1.0" encoding="UTF-8"?>';
    echo '<Response></Response>';

    $to = "";
    $subject = "Message from {$REQUEST['From']} at {$REQUEST['To']}";
    $message = "You have received a message from {$REQUEST['From']}. Body: {$REQUEST['Body']}";
    $headers = "From:";

    mail($to, $subject, $message, $headers);

Have another answer? Share your knowledge.