Sending emails from a droplet on which i didn't set a domain name doesn't work

Posted March 28, 2019 1.9k views
PHPUbuntu 18.04

I have a droplet that runs on Ubuntu 18.04 and i’m trying to send a few emails(2/day) to my own email accounts(Google and Yahoo). On this droplet i only have the IP up and running(no domain name) and i’m using PHPMailer.

The first email made it to Yahoo but since then no email survived(not even as SPAM).

Is there a problem with not having a domain name?

Thank you!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

You don’t need to have a domain associated with a droplet in order to send emails to external mail services. I suggest you take a look at the logs of your MTA (Mail Transfer Agent) to see what’s happening when the droplet tries to send an email.

You haven’t mentioned which exact MTA you’re using on your droplet (exim4, Postfix, sendmail, etc.) so I can’t point you to the exact log location, but you’ll likely find what you’re looking for in /var/log where all logs are usually stored. The logs will give you at least a general idea of what’s the root cause of the issue and will make further troubleshooting easier.

Also, it’s important to note that the emails you send from your droplet after you resolve the issue will likely start ending up in the Spam folder on the receiving end since you don’t have proper SPF, DKIM & DMARC DNS records for your droplet. There’s really no way around that other than manually marking the emails as not spam in an attempt to train the spam filters to start letting the emails coming from your droplet’s IP go to the Inbox folder.

  • My bad, i’m using sendmail.

    Good point, this is what i’m getting:

    Mar 28 20:15:04 [EDITED]: [EDITED]: to=<[EDITED]>, delay=01:46:58, xdelay=00:00:01, mailer=esmtp, pri=1217920, [], dsn=4.0.0, stat=Deferred: 421 4.7.0 [TSS04] Messages from [EDITED] temporarily deferred due to user complaints -; see

    User complaints?

    • Just having too many emails land in the spam folder can cause your emails to eventually be rate limited or blocked. If you have no domain name to send from, then you’re sending from an invalid hostname. Invalid hostnames will fail PTR and forward confirmed reverse DNS lookups, and will be seen as likely malicious by recipient services (most noteworthy being the big name services).

      You should at least use a subdomain and make sure that your droplet has that subdomain as it’s hostname, and that it is mentioned in the From field when sending email.

      Email has moved beyond the point where you can just casually toss an email to the big name services without consequence if you’re not doing it right. Mail servers are not as simple as they used to be (excluding people who have minimal needs and great luck with dice rolls). You should consider using an SMTP service to deliver these emails and get this off your plate. Check out the options here:

      I run mail servers professionally, and I wish it on no one. It is one of the most stressful jobs you will ever do, and that is why people pay money to let other people do it for them.

      • Well that seems painful @jarland . So basically, let’s say i’m sticking to my phpmailer and i setup a domain name - at this point my “From” field is just one of my emails. Should i replace that email with the hostname?

        • The most important this is to set a valid PTR record since that’s what most mail servers out these days. You would then send emails using the PTR subdomain or you could set up a SPF record in the DNS and authorize other domains along with the PTR subdomains as valid senders.

          If that is too much of a hassle for you, a better solution might be to use something like Amazon SES or Postmark. All of those services come with powerful APIs and it likely wouldn’t be too hard for you to get that going, although you’d still need a valid domain name.