- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 an Attachment with email using Perl
If you want to send an attachment in your email using Perl, then following script serves the purpose −
#!/usr/bin/perl use MIME::Lite; $to = 'abcd@gmail.com'; $cc = 'efgh@mail.com'; $from = 'webmaster@yourdomain.com'; $subject = 'Test Email'; $message = 'This is test email sent by Perl Script'; $msg = MIME::Lite-=>new( From => $from, To => $to, Cc => $cc, Subject => $subject, Type => 'multipart/mixed' ); # Add your text message. $msg->attach( Type => 'text', Data => $message ); # Specify your file as attachement. $msg->attach(Type => 'image/gif', Path => '/tmp/logo.gif', Filename => 'logo.gif', Disposition => 'attachment' ); $msg->send; print "Email Sent Successfully\n";
You can attach as many files as you like in your email using attach() method.
- Related Articles
- Sending an HTML Message using Perl
- How to send an attachment in email using Swift?
- How to send an email with a file attachment in Android using Kotlin?
- How to send an attachment in email using Swift(ios)?
- Sending a Plain Message using Perl
- How to send a email with attachment using a JSP page?
- How to send an email with a file attachment in Android?
- How to send a file as an email attachment using the Linux command line?
- Sending an HTML e-mail using Python
- Sending Attachments as an E-mail using Python
- Sending an itab to SAP Spool using ABAP method
- Send mail with attachment from your Gmail account using Python
- Set the Background Attachment with CSS
- Sending an Intent to browser to open specific URL using Kotlin.
- Sending HTTP error code using Express.js

Advertisements