send email with perl 587 and startssl

2011-07-22 Thread m...@smtp.fakessh.eu
hello folks

when is it the easiest solution to email  587 startssl and authentication

I arrived by writing this but the email sent does not contain the headers of 
the authentication

]$ cat emailsender1.pl
#!/usr/bin/perl

use Email::MIME;

my $message = Email::MIME-create(
                         header = [
                             From = 't...@titi.eu',
                             To   = 't...@toto.fr',
                                   ],
                          parts = [
                              q[ This is part one],
                              q[ This is part two],
                              q[ These could be binary too],
                              ],
                         );
  # produce an Email::Abstract compatible message object,
  # e.g. produced by Email::Simple, Email::MIME, Email::Stuff

  use Email::Sender::Simple qw(sendmail);
  use Email::Sender::Transport::SMTP qw();
  use Try::Tiny;
  my $SMTP_ENVELOPE_FROM_ADDRESS='t...@titi.eu';
  my $SMTP_HOSTNAME='smtp.titi.eu';
  my $SMTP_PORT=587;
  try {
    sendmail(
      $message,
      {
        from = $SMTP_ENVELOPE_FROM_ADDRESS,
        transport = Email::Sender::Transport::SMTP-new({
            host = $SMTP_HOSTNAME,
            port = $SMTP_PORT,
        })
      }
    );
  } catch {
      warn sending failed: $_;
  };

-- 
 http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x092164A7
 gpg --keyserver pgp.mit.edu --recv-key 092164A7


pgpT502b8eS7O.pgp
Description: PGP signature


Re: send email with perl 587 and startssl

2011-07-22 Thread Fayland Lam
Hi, if you check the doc carefully, you'll find there is ssl option 
which may help.


http://search.cpan.org/~rjbs/Email-Sender-0.110001/lib/Email/Sender/Transport/SMTP.pm 
http://search.cpan.org/%7Erjbs/Email-Sender-0.110001/lib/Email/Sender/Transport/SMTP.pm


Thanks

On 2011/7/23 9:51, m...@smtp.fakessh.eu wrote:

hello folks

when is it the easiest solution to email  587 startssl and authentication

I arrived by writing this but the email sent does not contain the headers of
the authentication

]$ cat emailsender1.pl
#!/usr/bin/perl

use Email::MIME;

my $message = Email::MIME-create(
  header =  [
  From =  't...@titi.eu',
  To   =  't...@toto.fr',
],
   parts =  [
   q[ This is part one],
   q[ This is part two],
   q[ These could be binary too],
   ],
  );
   # produce an Email::Abstract compatible message object,
   # e.g. produced by Email::Simple, Email::MIME, Email::Stuff

   use Email::Sender::Simple qw(sendmail);
   use Email::Sender::Transport::SMTP qw();
   use Try::Tiny;
   my $SMTP_ENVELOPE_FROM_ADDRESS='t...@titi.eu';
   my $SMTP_HOSTNAME='smtp.titi.eu';
   my $SMTP_PORT=587;
   try {
 sendmail(
   $message,
   {
 from =  $SMTP_ENVELOPE_FROM_ADDRESS,
 transport =  Email::Sender::Transport::SMTP-new({
 host =  $SMTP_HOSTNAME,
 port =  $SMTP_PORT,
 })
   }
 );
   } catch {
   warn sending failed: $_;
   };




--
Fayland Lam // http://www.fayland.org/