First of all, Net::SMTP is a core module, that should be installed whenever perl is installed. That said, your solution seems to be something like: #!/usr/bin/perl
use strict;
use warnings;
use Net::SMTP;
my $smtp = Net::SMTP->new(
Host => 'mailhost.from.com',
Hello => 'thishost.from.com'
);
$smtp->mail('from@from.com');
$smtp->to('to@to.com');
$smtp->data('this is the text of the message');
$smtp->quit;
[]s, HTH, Massa (κς,πμ,πλ)
| [reply] [d/l] |
This is the old way of accessing your sendmail program directly. It is generally frowned upon by Perler's, but it usually works. (on win32 your mail program may be called "blas", IIRC
#!/usr/bin/perl
use warnings;
use strict;
my $mailprog ="/usr/sbin/sendmail";
my $mailflags ="-t -n -oi";
my $recipient = 'recipient@domain.com';
my $msg_goes_here = "you're message";
open SENDMAIL, "| $mailprog $mailflags" or warn $!;
print SENDMAIL "From: user\@domain.com\n";
print SENDMAIL "To: $recipient\n";
print SENDMAIL "Subject: testing 123\n\n";
print SENDMAIL $msg_goes_here;
close SENDMAIL;
| [reply] [d/l] |
Assuming you have a shell login to your host, you can always install modules locally - in fact, this is usually a better way to go in any event, because then you can control which version you're using, when to upgrade, etc. And if you switch hosts, just tar up your perl directory and ftp it - you're guaranteed to have the same stuff at the new host. Read the docs for the CPAN module, and check the FAQs on this site for installing locally. | [reply] |
Many thanks for all the replies, they're all really helpful.
I haven't solved it yet as I need to look into the various suggestions of how to solve it and which would be most suitable for this situation, and that may take me some time.
Sarah | [reply] |