On 07/09/2017 10:55 PM, ToddAndMargo wrote:
Hi All,

From: https://github.com/retupmoca/P6-Net-SMTP

# raw interface
my $client = Net::SMTP.new(:server("your.server.here"), :port(587), :debug, :raw);
$client.get-response; # 220 your.server.here ...
$client.ehlo; # 250-STARTTLS\r\n250 ...
$client.mail-from('f...@your.server.here'); # 250 OK
$client.rcpt-to('t...@your.server.here'); # 250 OK
$client.data; # 354 Enter message
$client.payload($email); # 250 OK
$client.quit; # 221 closing connection

Where do I put the user name and password for the SMTP server?

It is either
     auth-login($username, $password)     or
     auth-plain($username, $password)

But where does it go?  After the $client.ehlo ??

Many thanks,
-T



This is what I have so far, and it just hangs.


# Note: :debug will send all output to stderr. (Errors will always be sent regardless.) if ( not my $client = Net::SMTP.new(:server( $smtp ), :port( $port ), :debug, :raw) ) {
           $ErrorCount += 1;
           PrintRed    ( "SMTP: unable to open $smtp\n" );
           AddToReport ( "SMTP: unable to open $smtp\n" );
           return;
        }
        
   $client.get-response;
   $client.ehlo;

   if ( not $client.auth-plain( $username, $password ) ) {
           $ErrorCount += 1;
PrintRed ( "SMTP: something is wrong with the username and/or password\n\n" ); AddToReport ( "SMTP: something is wrong with the username and/or password\n\n" );
           return;
        }
                
   $client.mail-from( $from );
   $client.rcpt-to( @to );
   $client.data;
if ( not $client.payload( $email ) ) { PrintRed "SMTP Error: Failed to send\n\n"; }
   $client.quit;



--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to