IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Programmation et administration système Perl Discussion :

Problème avec Net::SMTP


Sujet :

Programmation et administration système Perl

  1. #1
    Membre du Club
    Inscrit en
    Avril 2004
    Messages
    106
    Détails du profil
    Informations forums :
    Inscription : Avril 2004
    Messages : 106
    Points : 53
    Points
    53
    Par défaut Problème avec Net::SMTP
    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>

  2. #2
    Invité
    Invité(e)
    Par défaut
    Surprenant, ton script a l'air correct. J'en ai fait un copier / coller chez moi, en modifiant juste le mailserver et le destinataire, et pas de problème:
    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
    Net::SMTP>>> Net::SMTP(2.31)
    Net::SMTP>>>   Net::Cmd(2.29)
    Net::SMTP>>>     Exporter(5.62)
    Net::SMTP>>>   IO::Socket::INET(1.31)
    Net::SMTP>>>     IO::Socket(1.30_01)
    Net::SMTP>>>       IO::Handle(1.27)
    Net::SMTP=GLOB(0x19bb8cc)<<< 220 mwinf2a06.orange.fr ESMTP ABO *****************
    *********
    Net::SMTP=GLOB(0x19bb8cc)>>> EHLO localhost.localdomain
    Net::SMTP=GLOB(0x19bb8cc)<<< 250-mwinf2a06.orange.fr
    Net::SMTP=GLOB(0x19bb8cc)<<< 250-PIPELINING
    Net::SMTP=GLOB(0x19bb8cc)<<< 250-SIZE 10485760
    Net::SMTP=GLOB(0x19bb8cc)<<< 250-AUTH PLAIN LOGIN
    Net::SMTP=GLOB(0x19bb8cc)<<< 250-AUTH=PLAIN LOGIN
    Net::SMTP=GLOB(0x19bb8cc)<<< 250 8BITMIME
    Net::SMTP=GLOB(0x19bb8cc)>>> MAIL FROM:<p@p.com>
    Net::SMTP=GLOB(0x19bb8cc)<<< 250 Ok
    Net::SMTP=GLOB(0x19bb8cc)>>> RCPT TO:<p@p.com>
    Net::SMTP=GLOB(0x19bb8cc)<<< 250 Ok
    Net::SMTP=GLOB(0x19bb8cc)>>> DATA
    Net::SMTP=GLOB(0x19bb8cc)<<< 354 End data with <CR><LF>.<CR><LF>
    Net::SMTP=GLOB(0x19bb8cc)>>> Subject:Tests de connexion
    Net::SMTP=GLOB(0x19bb8cc)>>> Connexion
    Net::SMTP=GLOB(0x19bb8cc)>>> .
    Net::SMTP=GLOB(0x19bb8cc)<<< 250 Ok: queued as 435C27000098
    Net::SMTP=GLOB(0x19bb8cc)>>> QUIT
    Net::SMTP=GLOB(0x19bb8cc)<<< 221 Bye

  3. #3
    Expert éminent
    Avatar de Jedai
    Homme Profil pro
    Enseignant
    Inscrit en
    Avril 2003
    Messages
    6 245
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Avril 2003
    Messages : 6 245
    Points : 8 586
    Points
    8 586
    Par défaut
    Le serveur SMTP de kuzco est bien laxiste... Il faut deux passage à la ligne entre le header (Subject:, To:..) et le corps du message, ici tu n'en as mis qu'un, d'où la réponse du serveur : ton message ne respecte pas les RFC.

    (NB : Si tu ne connais pas du tout le protocole SMTP, il y a d'autres modules de plus haut niveau sur le CPAN pour générer et envoyer des mails)

    --
    Jedaï

  4. #4
    Invité
    Invité(e)
    Par défaut
    Citation Envoyé par Jedai Voir le message
    Le serveur SMTP de kuzco est bien laxiste...
    Faudra le dire à Orange.... c'est leur passerelle

  5. #5
    Membre du Club
    Inscrit en
    Avril 2004
    Messages
    106
    Détails du profil
    Informations forums :
    Inscription : Avril 2004
    Messages : 106
    Points : 53
    Points
    53
    Par défaut
    Merci Jedaï. Je teste et je vous rend compte.

Discussions similaires

  1. Problème avec .NET Framework 3.5
    Par emaluk dans le forum ASP.NET
    Réponses: 2
    Dernier message: 23/10/2009, 17h24
  2. envoie mail avec Net::SMTP + importance faible
    Par ouinih dans le forum Modules
    Réponses: 0
    Dernier message: 30/06/2008, 17h02
  3. problème avec le smtp host
    Par hocdz dans le forum API standards et tierces
    Réponses: 16
    Dernier message: 06/07/2007, 18h42
  4. problème avec net use
    Par El Leon dans le forum Windows
    Réponses: 1
    Dernier message: 30/05/2007, 16h27
  5. problème avec net::http
    Par piotr dans le forum Modules
    Réponses: 3
    Dernier message: 20/03/2006, 10h44

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo