Re: email on WIN32
by weismat (Friar) on Oct 26, 2009 at 12:47 UTC
|
I have used Net::SMTP:SSL together with Mime::Lite against yahoo in the past.
Example (untested)
#!/usr/local/bin/perl -w
use Net::SMTP::SSL;
$smtp = Net::SMTP::SSL->new('mailhost');
$smtp = Net::SMTP->new('smtp.bizmail.yahoo.com', Port=>465);
$smtp->auth($user, $password);
$smtp->mail();
$smtp->to('xxx');
$smtp->data();
$smtp->datasend("To: xxx\n");
$smtp->datasend("\n");
$smtp->datasend("$mime->as_string");
$smtp->dataend();
$smtp->quit;
You need to use the Winnipeg PPM to get any SSL related libs on Windows. | [reply] [d/l] |
Re: email on WIN32
by dorko (Prior) on Oct 26, 2009 at 13:15 UTC
|
I've been using Email::Stuff lately. Doesn't get any easier. From the docs (with a mod for using SMTP):
# Prepare the message
my $body = <<'AMBUSH_READY';
Dear Santa
I have killed Bun Bun.
Yes, I know what you are thinking... but it was actually a total acc
+ident.
I was in a crowded line at a BayWatch signing, and I tripped, and st
+ood on his head.
I know. Oops! :/
So anyways, I am willing to sell you the body for $1 million dollars
+.
Be near the pinhole to the Dimension of Pain at midnight.
Alias
AMBUSH_READY
# Create and send the email in one shot
Email::Stuff->from ('cpan@ali.as' )
->to ('santa@northpole.org' )
->bcc ('bunbun@sluggy.com' )
->text_body($body )
->attach (io('dead_bunbun_faked.gif')->all,
filename => 'dead_bunbun_proof.gif')
->using ('SMTP', Host => 'smtp.mail.yahoo.com')
->send;
Cheers,
Brent
| [reply] [d/l] |
|
|
Hi Brent
Here's what I'm doing (and it doesn't work). I'm feeling pretty stupid about this.
use Email::Stuff;
use IO::All;
$body = 'this is a test';
# Create and send the email in one shot
Email::Stuff->from ('brejen@comcast.net' )
->to ('ailithir@yahoo.com' )
->bcc ('slyder2412@hotmail.com' )
->text_body($body )
->attach (io('test.doc')->all,
filename => 'test.doc')
->using ('SMTP', Host => 'smtp.mail.yahoo.com')
->send;
| [reply] [d/l] |
|
|
| [reply] |
|
|
|
|
Re: email on WIN32
by GrandFather (Saint) on Oct 26, 2009 at 19:53 UTC
|
use strict;
use warnings FATAL => 'all';
use MIME::Lite;
my $toAddress = 'to@address.here';
my $fromAddress = 'from@address.here';
my $ccAddr;
my $buildPath;
my $options = "";
my $msg = MIME::Lite->new
(
From => $fromAddress,
To => $toAddress,
Subject => "build $buildPath",
Data => "build $buildPath $options"
);
$msg->Add (Cc => $ccAddr) if $ccAddr;
MIME::Lite->send ("smtp", "smtp.of.your.ma");
$msg->send;
True laziness is hard work
| [reply] [d/l] |
Re: email on WIN32
by afoken (Chancellor) on Oct 26, 2009 at 19:39 UTC
|
Use MIME::Lite. Configure it to use SMTP instead of sendmail (should be the default on Win32), configure it to use the requested mail server with a proper username and password. The first two examples in the Synopsis section of the documentation should really be helpful. Copy the second example (right below "Create a multipart message [...] and send it SMTP"), insert your e-mail addresses and host names, and run it. Note that you will very likely need to provide an account name and a password for sending via yahoo, so add the AuthUser and AuthPass parameters to send, as shown further down in the documentation.
Adapt the code to suit your needs. If you run into problems, show us your code and the error messages.
Alexander
--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
| [reply] [d/l] [select] |
Re: email on WIN32
by Discipulus (Canon) on Oct 27, 2009 at 08:57 UTC
|
between all your options to send mail, while you ar on win32 system with an SMTP server running I often use the core solution via the Win32::OLE module.
use Win32::OLE qw(with);
my $Message = Win32::OLE->new("CDO.Message");
$Message->{From}="a\@b.c";
$Message->{To}="b\@b.c";
$Message->{Bcc}="c\@b.c";
$Message->{Subject}="test subj";
$Message->{TextBody}="ahahahahahah\n\ndjhdjkfhdasjkfh";
$Message->Send()||die $Win32::OLE::LastError,$^E;
without the SMTP server locally, you have to specify which server you want use via a new object Win32::OLE->new ("CDO.Configuration") ;, and things go unfriendly ..
hth
Lor*
| [reply] [d/l] [select] |
|
|
thanks to all!
I got my procedure working by initializing smtp with 'localhost'...it did work with 'mail.yahoo.com' but yahoo didn't like it and rejected the messages after the 1st few.
Also Yahoo wanted authentication and that added another wrinkle.
| [reply] |