All Products
Search
Document Center

SMTP - Perl

Last Updated: Apr 07, 2022

The following example shows how to send an email through SMTP using Perl.

# Swaks is an smtp of CURL, install it first:
curl http://www.jetmore.org/john/code/swaks/files/swaks-20130209.0/swaks -o swaks
# Set the permissions for the script so you can run it.
chmod +x swaks
# It's based on perl, so install perl.
sudo apt-get -y install perl
# now send!
./swaks --auth \
        --server smtpdm.aliyun.com \
        --au domaintest@dm.aliyun.com \
        --ap ***** \
        --from domaintest@dm.aliyun.com \
        --to test@test.com \
        --h-Subject: "Hello" \
        --body 'Testing mail!'

Note: Replace

  • the content after “--au” with the sender address.

  • the content after “--ap” with the SMTP password.

  • the content after “--from” with the sender address.

  • the content after “--to” with the recipient address.