- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Sending a Plain Message using Perl
If you are working on Linux/Unix machine then you can simply use sendmail utility inside your Perl program to send email. Here is a sample script that can send an email to a given email ID. Just make sure the given path for sendmail utility is correct. This may be different for your Linux/Unix machine.
#!/usr/bin/perl $to = 'abcd@gmail.com'; $from = 'webmaster@yourdomain.com'; $subject = 'Test Email'; $message = 'This is test email sent by Perl Script'; open(MAIL, "|/usr/sbin/sendmail -t"); # Email Header print MAIL "To: $to\n"; print MAIL "From: $from\n"; print MAIL "Subject: $subject\n\n"; # Email Body print MAIL $message; close(MAIL); print "Email Sent Successfully\n";
Actually, the above script is a client email script, which will draft email and submit to the server running locally on your Linux/Unix machine. This script will not be responsible for sending email to actual destination. So you have to make sure email server is properly configured and running on your machine to send email to the given email ID.
- Related Articles
- Sending an HTML Message using Perl
- Sending an Attachment with email using Perl
- Sending message through WhatsApp in android?
- Sending HTTP error code using Express.js
- Sending an HTML e-mail using Python
- Sending personalised messages to user using JavaScript
- Creating a PDF in React JS using plain CSS and HTML
- How to convert a plain object into ES6 Map using JavaScript?
- IPC using Message Queues
- Create a Report Header using Perl
- Sending Attachments as an E-mail using Python
- Hello World using Perl.
- Explain Popup Message using Event?
- Sending an itab to SAP Spool using ABAP method
- Creating and Using Objects using Perl

Advertisements