SMTP - Perl

Last Updated: Dec 15, 2017

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

  1. # Swaks is an smtp of CURL, install it first:
  2. curl http://www.jetmore.org/john/code/swaks/files/swaks-20130209.0/swaks -o swaks
  3. # Set the permissions for the script so you can run it.
  4. chmod +x swaks
  5. # It's based on perl, so install perl.
  6. sudo apt-get -y install perl
  7. # now send!
  8. ./swaks --auth \
  9. --server smtpdm.aliyun.com \
  10. --au domaintest@dm.aliyun.com \
  11. --ap ***** \
  12. --from domaintest@dm.aliyun.com \
  13. --to test@test.com \
  14. --h-Subject: "Hello" \
  15. --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.
Thank you! We've received your feedback.