Hej chce wysłać maila z hostingu cba i mam problem taki:
2017-05-25 18:42:06 Could not access file: /var/tmp/file.tar.gz 2017-05-25 18:42:06 Could not access file: /tmp/image.jpg 2017-05-25 18:42:06 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ( ) 2017-05-25 18:42:06 Connection: opened 2017-05-25 18:42:06 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP g25sm2218307edg.38 - gsmtp 2017-05-25 18:42:06 CLIENT -> SERVER: EHLO aaaaa.cba.pl 2017-05-25 18:42:06 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [95.211.80.4] 250-SIZE 35882577 250-8BITMIME 250-STARTTLS 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-CHUNKING 250 SMTPUTF8 2017-05-25 18:42:06 CLIENT -> SERVER: STARTTLS 2017-05-25 18:42:06 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS 2017-05-25 18:42:06 CLIENT -> SERVER: EHLO aaaaa.cba.pl 2017-05-25 18:42:06 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [95.211.80.4] 250-SIZE 35882577 250-8BITMIME 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-CHUNKING 250 SMTPUTF8 2017-05-25 18:42:06 CLIENT -> SERVER: AUTH LOGIN 2017-05-25 18:42:06 SERVER -> CLIENT: 334 VXNlcm5hbWU6 2017-05-25 18:42:06 CLIENT -> SERVER: dHVycXVzMThAZ21haWwuY29t 2017-05-25 18:42:06 SERVER -> CLIENT: 334 UGFzc3dvcmQ6 2017-05-25 18:42:06 CLIENT -> SERVER: Q2h1ZHkxMjk= 2017-05-25 18:42:07 SERVER -> CLIENT: 534-5.7.14 Please log in via your web browser and 534-5.7.14 then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/answer/78754 g25sm2218307edg.38 - gsmtp 2017-05-25 18:42:07 SMTP ERROR: Password command failed: 534-5.7.14 Please log in via your web browser and 534-5.7.14 then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/answer/78754 g25sm2218307edg.38 - gsmtp 2017-05-25 18:42:07 SMTP Error: Could not authenticate. 2017-05-25 18:42:07 CLIENT -> SERVER: QUIT 2017-05-25 18:42:07 SERVER -> CLIENT: 221 2.0.0 closing connection g25sm2218307edg.38 - gsmtp 2017-05-25 18:42:07 Connection: closed 2017-05-25 18:42:07 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Darmowy Hosting CBA.PL
<?php
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'xxx@gmail.com'; // SMTP username
$mail->Password = 'xxx'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom('xxx@gmail.com', 'Mailer');
$mail->addAddress('xxx@interia.pl', 'Julka'); // Add a recipient
$mail->addAddress('ellen@example.com'); // Name is optional
$mail->addReplyTo('info@example.com', 'Information');
$mail->addCC('cc@example.com');
$mail->addBCC('bcc@example.com');
$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
Co zrobiłem zle?:/
Jak zmienilem port na 465 i zakomentowalem addatachment i te niezbedne nie ktore to mam :
2017-05-25 18:48:07 Connection: opening to smtp.gmail.com:465, timeout=300, options=array ( ) 2017-05-25 18:48:07 Connection: opened 2017-05-25 18:48:17 SERVER -> CLIENT: 2017-05-25 18:48:17 SMTP NOTICE: EOF caught while checking if connected 2017-05-25 18:48:17 Connection: closed 2017-05-25 18:48:17 SMTP Error: Could not connect to SMTP host. 2017-05-25 18:48:17 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting