Re: send email with perl 587 and startssl

2011-07-25 Thread Fayland Lam
maybe this: 
http://search.cpan.org/perldoc?Email::Sender::Transport::SMTP::TLS


Thanks

On 2011/7/25 22:06, Jesse Thompson wrote:
It looks like Email::Sender::Transport::SMTP uses Net::SMTP::SSL, 
which only supports SSL (establishes a secure channel before any SMTP 
occurs, port 465) and not STARTTLS (the SMTP connection is established 
and then is "upgraded" to TLS, port 587 and sometimes 25)


Net::SMTP::TLS is probably what you are looking for.  I have used it 
in my code, and I know that it works.  There may be other modules that 
support STARTTLS as well.


I don't know if there is an easy way to get Net::SMTP::TLS to work 
with Email::Sender::Transport::SMTP.  Perhaps you could use 
Net::SMTP::TLS directly with Email::Sender::Simple?


Jesse

On 7/22/11 9:49 PM, m...@smtp.fakessh.eu wrote:

Le samedi 23 juillet 2011 03:59, Fayland Lam a écrit :

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/Transpo 


rt/SMTP.pm


Thanks



i check the doc carefully
and I realized that I did not look at these options

i re writte my script with this option

   my $SMTP_ENVELOPE_FROM_ADDRESS='t...@titi.eu';
   my $SMTP_HOSTNAME='smtp.titi.eu';
   my $SMTP_PORT=587;
   my $SMTP_SSL=1;
   my $SMTP_SASL_USERNAME='titi';
   my $SMTP_SASL_PASSWORD='titi';
   try {
 sendmail(
   $message,
   {
 from =>  $SMTP_ENVELOPE_FROM_ADDRESS,
 transport =>  Email::Sender::Transport::SMTP->new({
 host =>  $SMTP_HOSTNAME,
 port =>  $SMTP_PORT,
 ssl  =>  $SMTP_SSL,
 sasl_username =>  $SMTP_SASL_USERNAME,
 sasl_password =>  $SMTP_SASL_PASSWORD,
 })
   }
 );
   } catch {
   warn "sending failed: $_";
   };

the result is now a complete failure


~]$ perl emailsender1.pl
sending failed: unable to establish SMTP connection at 
emailsender1.pl line

43.

~]# tail -f /var/log/maillog
2011-07-23 04:48:53imap(fakessh): Info: Disconnected: Logged out
bytes=2070/5878
Jul 23 04:49:47 r13151 postfix/smtpd[2445]: connect from
r13151.ovh.net[87.98.186.232]
Jul 23 04:49:47 r13151 postfix/smtpd[2445]: too many errors after 
UNKNOWN from

r13151.ovh.net[87.98.186.232]
Jul 23 04:49:47 r13151 postfix/smtpd[2445]: disconnect from
r13151.ovh.net[87.98.186.232]


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/



Re: send email with perl 587 and startssl

2011-07-25 Thread Chris Nehren
On Jul 22, 2011, at 21: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


Have you tried E::S::T::SMTP::TLS?

-- 
Thanks and best regards,
Chris Nehren



Re: send email with perl 587 and startssl

2011-07-25 Thread Jesse Thompson
It looks like Email::Sender::Transport::SMTP uses Net::SMTP::SSL, which 
only supports SSL (establishes a secure channel before any SMTP occurs, 
port 465) and not STARTTLS (the SMTP connection is established and then 
is "upgraded" to TLS, port 587 and sometimes 25)


Net::SMTP::TLS is probably what you are looking for.  I have used it in 
my code, and I know that it works.  There may be other modules that 
support STARTTLS as well.


I don't know if there is an easy way to get Net::SMTP::TLS to work with 
Email::Sender::Transport::SMTP.  Perhaps you could use Net::SMTP::TLS 
directly with Email::Sender::Simple?


Jesse

On 7/22/11 9:49 PM, m...@smtp.fakessh.eu wrote:

Le samedi 23 juillet 2011 03:59, Fayland Lam a écrit :

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/Transpo
rt/SMTP.pm


Thanks



i check the doc carefully
and I realized that I did not look at these options

i re writte my script with this option

   my $SMTP_ENVELOPE_FROM_ADDRESS='t...@titi.eu';
   my $SMTP_HOSTNAME='smtp.titi.eu';
   my $SMTP_PORT=587;
   my $SMTP_SSL=1;
   my $SMTP_SASL_USERNAME='titi';
   my $SMTP_SASL_PASSWORD='titi';
   try {
 sendmail(
   $message,
   {
 from =>  $SMTP_ENVELOPE_FROM_ADDRESS,
 transport =>  Email::Sender::Transport::SMTP->new({
 host =>  $SMTP_HOSTNAME,
 port =>  $SMTP_PORT,
 ssl  =>  $SMTP_SSL,
 sasl_username =>  $SMTP_SASL_USERNAME,
 sasl_password =>  $SMTP_SASL_PASSWORD,
 })
   }
 );
   } catch {
   warn "sending failed: $_";
   };

the result is now a complete failure


~]$ perl emailsender1.pl
sending failed: unable to establish SMTP connection at emailsender1.pl line
43.

~]# tail -f /var/log/maillog
2011-07-23 04:48:53imap(fakessh): Info: Disconnected: Logged out
bytes=2070/5878
Jul 23 04:49:47 r13151 postfix/smtpd[2445]: connect from
r13151.ovh.net[87.98.186.232]
Jul 23 04:49:47 r13151 postfix/smtpd[2445]: too many errors after UNKNOWN from
r13151.ovh.net[87.98.186.232]
Jul 23 04:49:47 r13151 postfix/smtpd[2445]: disconnect from
r13151.ovh.net[87.98.186.232]


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: $_";
};






smime.p7s
Description: S/MIME Cryptographic Signature


Re: send email with perl 587 and startssl

2011-07-22 Thread m...@smtp.fakessh.eu
Le samedi 23 juillet 2011 03:59, Fayland Lam a écrit :
> 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/Transpo
>rt/SMTP.pm
> sport/SMTP.pm>
>
> Thanks
>

i check the doc carefully
and I realized that I did not look at these options

i re writte my script with this option

  my $SMTP_ENVELOPE_FROM_ADDRESS='t...@titi.eu';
  my $SMTP_HOSTNAME='smtp.titi.eu';
  my $SMTP_PORT=587;
  my $SMTP_SSL=1;
  my $SMTP_SASL_USERNAME='titi';
  my $SMTP_SASL_PASSWORD='titi';
  try {
sendmail(
  $message,
  {
from => $SMTP_ENVELOPE_FROM_ADDRESS,
transport => Email::Sender::Transport::SMTP->new({
host => $SMTP_HOSTNAME,
port => $SMTP_PORT,
ssl  => $SMTP_SSL,
sasl_username => $SMTP_SASL_USERNAME,
sasl_password => $SMTP_SASL_PASSWORD,
})
  }
);
  } catch {
  warn "sending failed: $_";
  };

the result is now a complete failure


~]$ perl emailsender1.pl
sending failed: unable to establish SMTP connection at emailsender1.pl line 
43.

~]# tail -f /var/log/maillog
2011-07-23 04:48:53imap(fakessh): Info: Disconnected: Logged out 
bytes=2070/5878
Jul 23 04:49:47 r13151 postfix/smtpd[2445]: connect from 
r13151.ovh.net[87.98.186.232]
Jul 23 04:49:47 r13151 postfix/smtpd[2445]: too many errors after UNKNOWN from 
r13151.ovh.net[87.98.186.232]
Jul 23 04:49:47 r13151 postfix/smtpd[2445]: disconnect from 
r13151.ovh.net[87.98.186.232]

> 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: $_";
> >};

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


pgpBed06xjK1P.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 



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/