Bonjour,

J'ai essayé un petit script d'envoi de mail avec le module Net::SMTP. Mais ça ne marche pas: il renvoie l'erreur 554 Le message ne respecte pas les RFC. J'envoie mon code avec le résultat. Puissiez-vous m'aider svp.
Le code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
use strict;
use Net::SMTP;
 
my $mailserver="10.125.10.10";
my $smtp = Net::SMTP->new($mailserver, , ,Debug=>1);
   $smtp->mail('mail@domain.sf');
   $smtp->to('mail@domain.sf');
   $smtp->data();
   #$smtp->datasend("To:mail\@domain.sf\n");
   #$smtp->datasend("From:mail\@domain.sf\n");
   $smtp->datasend("Subject:Tests de connexion\n");
   $smtp->datasend("Connexion");
   $smtp->datasend("\n");
   $smtp->dataend();
 
   $smtp->quit;
Le résultat du mode Debug:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 
C:\Documents and Settings\do32\Mes documents\scripts>perl -w test.pl
Net::SMTP>>> Net::SMTP(2.26)
Net::SMTP>>>   Net::Cmd(2.24)
Net::SMTP>>>     Exporter(5.57)
Net::SMTP>>>   IO::Socket::INET(1.27)
Net::SMTP>>>     IO::Socket(1.28)
Net::SMTP>>>       IO::Handle(1.23)
Net::SMTP=GLOB(0x1af9138)<<< 220 domain.sf ESMTP MDaemon 9.6.2; Fri, 16 Jan 2009 1
1:54:02 +0000
Net::SMTP=GLOB(0x1af9138)>>> EHLO localhost.localdomain
Net::SMTP=GLOB(0x1af9138)<<< 250-domain.sf Hello localhost.localdomain, pleased to
 meet you
Net::SMTP=GLOB(0x1af9138)<<< 250-ETRN
Net::SMTP=GLOB(0x1af9138)<<< 250-AUTH=LOGIN
Net::SMTP=GLOB(0x1af9138)<<< 250-AUTH LOGIN CRAM-MD5
Net::SMTP=GLOB(0x1af9138)<<< 250-8BITMIME
Net::SMTP=GLOB(0x1af9138)<<< 250 SIZE 0
Net::SMTP=GLOB(0x1af9138)>>> MAIL FROM:<mail@domain.sf>
Net::SMTP=GLOB(0x1af9138)<<< 250 <mail@domain.sf>, Sender ok
Net::SMTP=GLOB(0x1af9138)>>> RCPT TO:<mail@domain.sf>
Net::SMTP=GLOB(0x1af9138)<<< 250 <mail@domain.sf>, Recipient ok
Net::SMTP=GLOB(0x1af9138)>>> DATA
Net::SMTP=GLOB(0x1af9138)<<< 354 Enter mail, end with <CRLF>.<CRLF>
Net::SMTP=GLOB(0x1af9138)>>> Subject:Tests de connexion
Net::SMTP=GLOB(0x1af9138)>>> Connexion
Net::SMTP=GLOB(0x1af9138)>>> .
Net::SMTP=GLOB(0x1af9138)<<< 554 Le message ne respecte pas les RFC
Net::SMTP=GLOB(0x1af9138)>>> QUIT
Net::SMTP=GLOB(0x1af9138)<<< 221 See ya in cyberspace
 
C:\Documents and Settings\do32\Mes documents\scripts>