phpmailer

Secţiune dedicată începatorilor.

Moderatori: Moderatori, Start Moderator

s1gm0
PHPRomania Supporter
Mesaje: 25
Membru din: Mie Sep 09, 2009 12:10 pm

phpmailer

Mesajde s1gm0 » Dum Aug 14, 2011 9:39 am

Salutare

Am incercat sa trimit de pe localhost un mail folosind serverul de smtp de la gmail impreuna cu clasa phpmailer dar imi da eroare.
Daca incerc pe linux merge dar pe w7 nu...
Cand rulez scriputul apare fundalul alb fara nicio eroare

Astept sugestii ms.



nevvermind
Senior Member
Mesaje: 1264
Membru din: Mar Iun 22, 2010 3:17 pm

Mesajde nevvermind » Dum Aug 14, 2011 12:47 pm

Pune

$phpMailer->SMTPDebug = 1;

si vezi ce spune.

s1gm0
PHPRomania Supporter
Mesaje: 25
Membru din: Mie Sep 09, 2009 12:10 pm

Mesajde s1gm0 » Dum Aug 14, 2011 4:46 pm

nevvermind scrie:Pune

$phpMailer->SMTPDebug = 1;

si vezi ce spune.


acelasi lucru ... fundal alb

nevvermind
Senior Member
Mesaje: 1264
Membru din: Mar Iun 22, 2010 3:17 pm

Mesajde nevvermind » Dum Aug 14, 2011 6:07 pm

ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);

s1gm0
PHPRomania Supporter
Mesaje: 25
Membru din: Mie Sep 09, 2009 12:10 pm

Mesajde s1gm0 » Dum Aug 14, 2011 6:42 pm

nevvermind scrie:ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);


la fel... verificati scriptul poate e ceva ce e greist...

Cod: Selectaţi tot

$mail = new PHPMailer();

$mail->IsSMTP();                      // telling the class to use SMTP
$mail->SMTPDebug  = 1;                        // enables SMTP debug information (for testing)

$mail->SMTPAuth = true;                     // enable SMTP authentication
$mail->SMTPKeepAlive = false;                  // SMTP connection will not close after each email sent
$mail->Host = "smtp.gmail.com";            // sets the SMTP server
$mail->Port = 465;                          // set the SMTP port for the GMAIL server
$mail->Username = "id@gmail.com";    // SMTP account username
$mail->Password = "parola";           // SMTP account password

$mail->SetFrom("id@gmail.com", "test mail");

$mail->Subject = "PHPMailer Test Subject via smtp";
$body = "Mesaj de test trimis cu smtp gmail";

$mail->MsgHTML($body);
$mail->AddAddress("s1gm0@yahoo.com", "Adelin");

if( ! $mail->Send() )
   echo "Mailer Error: " . $mail->ErrorInfo;
else
   echo "Message sent!";

nevvermind
Senior Member
Mesaje: 1264
Membru din: Mar Iun 22, 2010 3:17 pm

Mesajde nevvermind » Dum Aug 14, 2011 9:55 pm

Pare bun, dar portul 465 este rezervat (de obicei) pt SSL. Deci mai incearca cu:
$mail->SMTPSecure = "tls";

PS:
Daca pui "SMTPKeepAlive = false", asta face opusul comentariului aferent. Daca trimiti mai multe, pune-l true si inchizi conexiunea cu SmtpClose().

s1gm0
PHPRomania Supporter
Mesaje: 25
Membru din: Mie Sep 09, 2009 12:10 pm

Mesajde s1gm0 » Lun Aug 15, 2011 8:25 am

daca iti zic ca e aceeasi problema cu fundalul alb ma crezi? :|

am modificat si am pus cum ai zis cu Secure...
am si:
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
si tot nu arata nicio eroare :|

nu e portul bun ? sau de la ce sa fie?

MihaiA
Average Member
Mesaje: 184
Membru din: Lun Aug 25, 2008 5:33 pm

Mesajde MihaiA » Lun Aug 15, 2011 9:51 am

incearca portul 487/587, parca 465 este blocat de catre rds(asta in cazul in care ai rds).

s1gm0
PHPRomania Supporter
Mesaje: 25
Membru din: Mie Sep 09, 2009 12:10 pm

Mesajde s1gm0 » Lun Aug 15, 2011 10:16 am

MihaiA scrie:incearca portul 487/587, parca 465 este blocat de catre rds(asta in cazul in care ai rds).


da am rds...

cu portul 487 imi da eroarea:

Cod: Selectaţi tot

SMTP -> ERROR: Failed to connect to server: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (10060)
SMTP Error: Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host.


cu portul 587 imi da eroarea:

Cod: Selectaţi tot

Warning: stream_socket_enable_crypto() [streams.crypto]: this stream does not support SSL/crypto in ...\php5\class.smtp.php on line 197


am lasat portul 587 si nu am mai pus $mail->SMTPSecure = "tls";
si imi da eroarea:

Cod: Selectaţi tot

SMTP -> ERROR: AUTH not accepted from server: 530 5.7.0 Must issue a STARTTLS command first. x1sm1861887fah.2
SMTP Error: Could not authenticate. Mailer Error: SMTP Error: Could not authenticate.


userul si parola sunt buna le-am verificat de 2 ori

alte pareri?


Înapoi la “PHP Incepători”

Cine este conectat

Utilizatori ce ce navighează pe acest forum: Google [Bot] și 44 vizitatori