Tag: smtp

  • Fake SMTP Server for testing

    Fake SMTP Server for testing

    When you develop a website or an application, you may need to use a fake SMTP server for debugging. Fake SMTP servers access emails, but they won’t deliver emails to the recipient’s email address.

    The simplest way to run a debugging SMTP server is using the following python code

    python3 -m smtpd -n -c DebuggingServer 0.0.0.0:2525
    

    This will start an SMTP server on port 2525. It does not support SMTP authentication.

    If you want to run a Fake SMTP server with Authentication support, use

    https://github.com/rnwood/smtp4dev

    You can install it using docker.

    First you need to install Docker. On Ubuntu, run

    apt install docker.io
    

    Run smtp4dev with the command

    docker run -d -it -p 3000:80 -p 2525:25 --restart=unless-stopped rnwood/smtp4dev
    

    SMTP Server will listen on port 2525. On port 3000, you have a web interface to read the mails

    Fake SMTP Server

    See SMTP

  • Maildev – Fake SMTP server for development

    Maildev – Fake SMTP server for development

    maildev is a fake SMTP server + interface to read the mail. It is useful for web developers during development stage where they don’t want email sents to read email address.

    maildev fake smtp server

    To run maildev using docker, run

    docker run -p 1080:80 -p 25:25 maildev/maildev
    

    Now you will be able to access web interface to read emails on port 1080

    http://your-server-ip:1080
    

    Fake SMTP server will be listening on Port 25. No authentication required. It work like an Open relay SMTP server with no autentication.

    If you keep it running, you will see some Spam mails in your inbox as spamers try to send email using your maildev fake SMTP server, that end up in your web interface instead of actual recipient they sending the mail to.

    To test, you can sent a mail using swaks or telnet

    swaks --to user@example.com --server  MAILDEV_SERVER_IP_HERE
    
  • swaks – Command line SMTP Testing Tool

    swaks is a command line SMTP testing tool available at

    http://www.jetmore.org/john/code/swaks/

    On Debian/Ubuntu, you can install it with the command

    apt install swaks
    swaks mail testing tool

    if you just type swaks, it will ask for your email, then send a mail using MX Record to a specified email address.

    To send email using a specific mail server

    swaks --to user@example.com --server test-server.example.net

    Deliver a standard test email, requiring CRAM-MD5 authentication as user me@example.com. An “X-Test” header will be added to the email body. The authentication password will be prompted for if it cannot be obtained from your .netrc file.

    swaks --to user@example.com --from me@example.com --auth CRAM-MD5 --auth-user me@example.com --header-X-Test "test email"

    Here is an example command that uses a remote SMTP server to send email. I used this on a backup bash script to send email alters after the backup was completed.

    swaks --to serverok.in@gmail.com --from labs@serverok.in --server smtp1.serverok.in --auth-user labs@serverok.in --auth-password '7XwlzPnSmlsWsdbS' --body "This is a test message" --header 'Subject: Backup completed'

    To send email from cpanel server, use

    swaks --to serverok.in@gmail.com \
          --server server46.hostonnet.com \
          --port 587 \
          --from support@serverok.in \
          --auth-user support@serverok.in \
          --auth-password 'PW_HERE' \
          --body "This is a test message" \
          --header 'Subject: Backup completed' \
          --auth \
          --tls

    See SMTP

  • SMTP

    To verify SMTP SPF/DKIM etc are set properly, sent a mail to check-auth2@verifier.port25.com, check the reply.

    Cloud providers like Amazon AWS, Alibaba, Microsoft Azure, Google Cloud and DigitalOcean do not allow you to run your own mail server. If you need to sent an email from your web application, you need to use one of the Transnational Email Services.

    Amazon AWS

    How to set Reverse DNS on Amazon EC2. Remove Email Restriction
    Amazon EC2
    Amazon Lightsail rDNS

    Alibaba Cloud

    Alibaba Cloud won’t allow SMTP. In case you need an SMTP port, you can request, but it only allows you to send emails using a third-party SMTP server. If you install an SMTP server on your server, Alibaba cloud will permanently disable port 25. For more info, see

    https://www.alibabacloud.com/help/faq-detail/56130.htm

    If your site needs to send an email, use DirectMail, transactional email service provided by Alibaba Cloud

    AlibabaCloud DirectMail

    Google Cloud

    https://cloud.google.com/compute/docs/tutorials/sending-mail/

    Microsoft Azure

    https://blogs.msdn.microsoft.com/mast/2017/11/15/enhanced-azure-security-for-sending-emails-november-2017-update/

    DigitalOcean

    They only allow SMTP after 60 days of use to avoid spam. Source: See pinned answer by alexdo

    Vulr

    Vultr blocks the SMTP port by default.

    https://www.vultr.com/docs/what-ports-are-blocked

    You need to fill out the form below to unblock the SMTP port.

    https://my.vultr.com/billing/unblock_smtp_port/

    Linode

    SMTP is blocked by default. To unblock, create A record + rDNS for the hostname. Then open a support ticket at

    https://www.linode.com/community/questions/19082/i-just-created-my-first-linode-and-i-cant-send-emails-why