use warnings;
use MIME::Lite;
use Net::SMTP;
### Adjust sender, recipient and your SMTP mailhost
my $from_address = '[email protected]';
my $to_address = '[email protected]';
my $mail_host = 'smtp.office365.com';
### Adjust subject and body message
my $subject = 'A message with 2 parts ...';
my $message_body = "Here's the attachment file(s) you wanted";
### Adjust the filenames
my $my_file_txt = 'C:\Users\Doni\Documents';
my $your_file_txt = 'test1.txt';
### Create the multipart container
$msg = MIME::Lite->new (
From => $from_address,
To => $to_address,
Subject => $subject,
Type =>'multipart/mixed'
) or die "Error creating multipart container: $!\n";
### Add the text message part
$msg->attach (
Type => 'TEXT',
Data => $message_body
) or die "Error adding the text message part: $!\n";
### Add the TEXT file
$msg->attach (
Type => 'text',
Encoding => 'base64',
Path => $my_file_txt,
Filename => $your_file_txt,
Disposition => 'attachment'
) or die "Error adding file_text: $!\n";
##Send
MIME::Lite->send('smtp',$mail_host,SSL=>0,AuthUser=>'[email protected]',AuthPass=>'******',Debug=>1,Port=>587,Timeout=>60);
$msg->send;
die Ausgabe des Befehls lautet:SMTP-Auth() Befehl nicht auf smtp.office365.com unterstützt
##Here's the output
SMTP auth() command not supported on smtp.office365.com
, wie das Problem zu lösen? Ich bleibe dabei.
zu setzen Du könntest stattdessen auch das Net :: SMTP (Kernmodul) benutzen und einfach einen '$ mailer-> starttls() 'nach dem Herstellen der Verbindung. Ein weniger zu installierendes Modul. Sie könnten auch '$ mailer-> data ($ msg-> as_string)' eingeben und das 'datesend' und' dataend' überspringen. –
zwei Daumen hoch für dich bro @SteffenUllrich –