• Publicidad

Problema con SMTP auth() command failed

¿Ya sabes lo que es una referencia? Has progresado, el nível básico es cosa del pasado y ahora estás listo para el siguiente nivel.

Problema con SMTP auth() command failed

Notapor bassnez » 2014-12-09 13:38 @610

Hola, soy un estudiante y en este momento me encuentro con un problema que hace mucho no puedo solucionar el cual es que he intentado con todos los módulos para enviar adjuntos en correos desde un script hacia el SMTP de mis correos, ya sea Gmail o Hotmail, pero el asunto es que no logro conectarme al servidor :evil: El script lo estoy haciendo correr en Ubuntu 14.

Por favor, si alguien puede darme la solución a esto se lo agradecería mucho :D

[img]Captura%20de%20pantalla%20de%202014-12-09%2015:37:46.jpg[/img]

Este es mi script:
Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
  1. ##Create a new multipart message:
  2.         $msg = MIME::Lite->new(
  3.         From    => '[email protected]',
  4.         To      => '[email protected]',
  5.         #Cc      => '[email protected], [email protected]',
  6.         Subject => 'A message with 2 parts...',
  7.         Type    => 'multipart/mixed'
  8.     );
  9.  
  10.     ##Add parts (each "attach" has same arguments as "new"):
  11.     $msg->attach(
  12.         Type     => 'TEXT',
  13.         Data     => "Here's the GIF file you wanted"
  14.     );
  15.     $msg->attach(
  16.         #Type     => '',
  17.         #Path     => $entrada,
  18.         #Filename => 'logo.gif',
  19.         Disposition => 'attachment'
  20.     );
  21.    
  22.       $msg->send('smtp','smtp.gmail.com', AuthUser => '[email protected]', AuthPass => 'xxxx', Debug => 1);
  23.  
  24. # Test perl SMTP
  25. #
  26. $account= '[email protected]';
  27. $password='xxxxx';
  28. $smtp = Net::SMTP::SSL->new(
  29. Host => 'mx1.hotmail.com',
  30. Port => 465,
  31. Timeout => 120
  32. ); # connect to an SMTP server
  33. die "Couldn't open connection: $!" if (!defined $smtp );
  34. $smtp->auth($account,$password);
  35. $smtp->mail( '[email protected]' ); # use the sender's address here
  36. $smtp->to( '[email protected]'); # recipient's address
  37. $smtp->data(); # Start the mail
  38. # Send the header.
  39. $smtp->datasend("To: recipient\@thatdomain.com\n");
  40. $smtp->datasend("From: me\@mydomain.com\n");
  41. $smtp->datasend("Subject: Test Message\n");
  42. $smtp->datasend("\n");
  43. # Send the body.
  44. $smtp->datasend("Test Message!\n");
  45. $smtp->dataend(); # Finish sending the mail
  46. $smtp->quit; # Close the SMTP connection
  47. print "Done!";
Coloreado en 0.005 segundos, usando GeSHi 1.0.8.4
bassnez
Perlero nuevo
Perlero nuevo
 
Mensajes: 3
Registrado: 2014-12-09 13:12 @591

Publicidad

Re: Problema con SMTP auth() command failed

Notapor explorer » 2014-12-09 17:51 @785

Bienvenido a los foros de Perl en Español, bassnez.

Si quieres enviar a Gmail, lo recomendado es usar algún módulo específico, como Email::Send::Gmail, o mejor, Email::Send::SMTP::Gmail (en la página hay un ejemplo de cómo enviar un adjunto). Este último también se puede usar con otros dominios, no solo Gmail.

De todos modos, sería recomendable ver completa la traza del error.
JF^D Perl programming & Raku programming. Grupo en Telegram: https://t.me/Perl_ES
Avatar de Usuario
explorer
Administrador
Administrador
 
Mensajes: 14476
Registrado: 2005-07-24 18:12 @800
Ubicación: Valladolid, España

Re: Problema con SMTP auth() command failed

Notapor bassnez » 2014-12-09 22:50 @993

Muchas gracias por responderme, explorer :D Intentaré con los módulos que me mostraste. Si llego a buen puerto o no te lo hago saber. Que esté muy bien...

explorer: sí, ahora puedo recibir los correos pero no el adjunto. Mira, me sale esto... Instalé también el módulo io:socket::ssl.
Sintáxis: [ Descargar ] [ Ocultar ]
Using text Syntax Highlighting
Argument "" isn't numeric in numeric ne (!=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 2026, <GEN1> line 10.
Argument "" isn't numeric in bitwise and (&) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 2176, <GEN1> line 10.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 2555.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 1354.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 563.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 599.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 651.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 663.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 673.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 683.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 703.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 663.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 673.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 683.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 703.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 663.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 673.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 683.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 703.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 663.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 718.
No RCPT found. Please add the TO field
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 2555.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 539.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 541.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 563.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 596.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 651.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 663.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 673.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 683.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 703.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 663.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 673.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 683.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 703.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 2411.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 2411.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 2411.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 2411.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 1559.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 1569.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 663.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 673.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 683.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 703.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 663.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 718.
Done!Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 2588.
Use of uninitialized value $IO::Socket::SSL::DEBUG in numeric ge (>=) at /usr/local/share/perl/5.18.2/IO/Socket/SSL.pm line 2600.
Coloreado en 0.002 segundos, usando GeSHi 1.0.8.4

Lo acabo de lograr, explorer :D a pesar que no sé qué problema me tira, lo que mandé arriba, pero me funcionó, por fin, muchas gracias por todo. Te pasaste. Que te vaya muy bien...
bassnez
Perlero nuevo
Perlero nuevo
 
Mensajes: 3
Registrado: 2014-12-09 13:12 @591

Re: Problema con SMTP auth() command failed

Notapor explorer » 2014-12-10 08:17 @387

Los dos primeros errores creo que son debidos a que está mal instalado Net::SSLeay.

Y los siguientes... quizás tienes activado la opción 'strict' o la de 'warnings'. Lo podrías quitar y así ya no los ves.

O también... en el programa pones $IO::Socket::SSL::DEBUG = 0; (o a otro valor) y ya está.
JF^D Perl programming & Raku programming. Grupo en Telegram: https://t.me/Perl_ES
Avatar de Usuario
explorer
Administrador
Administrador
 
Mensajes: 14476
Registrado: 2005-07-24 18:12 @800
Ubicación: Valladolid, España

Re: Problema con SMTP auth() command failed

Notapor bassnez » 2014-12-10 13:08 @589

Gracias, explorer :D maestro.
bassnez
Perlero nuevo
Perlero nuevo
 
Mensajes: 3
Registrado: 2014-12-09 13:12 @591


Volver a Intermedio

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 5 invitados