From: "Fúlvio Figueirôa" <fulvi...@gmail.com>
Hi Octavian,
I solved my problem using sendmail with the code below:

open (MAIL, "|/usr/sbin/sendmail -t ");
print MAIL "From: someaddr...@somedomain\n";
print MAIL "To: someaddre...@somedomain\n";
print MAIL "Content-Type: text/plain\n";
print MAIL "Subject: Very simple email test\n\n";
print MAIL "Body of the message";
close (MAIL);

If you can use sendmail and if you also need to send email messages with attachments or html emails eventually with inline images (and for more other features), you can use Mail::Builder::Simple. (You can also use it for sending email with an SMTP server, or with Gmail, sendmail, qmail...)

Here is an example for sending a plaintext message:

use Mail::Builder::Simple;

my $mail = Mail::Builder::Simple->new;

$mail->send(
 from => 'm...@host.com',
 to => 'y...@yourhost.com',
 subject => 'The subject with UTF-8 chars',
 plaintext => "Hello,\n\nHow are you?\n",
);

If you want to also send an html part an an attachment, you will need to add:

htmltext => '<h1>Hello</h1><p>Here is a test message.</p>',
attachment => 'file.pdf',

This module allows sending UTF-8 encoded messages (body and headers) without needing to do the encoding manually.

http://search.cpan.org/author/TEDDY/Mail-Builder-Simple-0.02/lib/Mail/Builder/Simple.pm

Octavian


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to