Nejste přihlášeni
Dobrý den,
na mé doméně romansheep.me mi nefunguje phpmailer.
Otestoval jsem vše na localhostu a emaily to normálně odesílá, ale když svůj web nahraji na váš hosting, tak se email neodešle.
$mail->isSMTP(true); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'romansheep.business@gmail.com'; // SMTP username
$mail->Password = $password; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom($email, $name);
$mail->addAddress('romakcz@gmail.com', 'Joe User'); // Add a recipient // Name is optional
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $subject;
$mail->Body = $message;
$mail->AltBody = $message;
if($mail->send()) {
$send_email = 'Your email was succesfully send!';
$err = $mail->ErrorInfo;
echo $err;
}
else {
$send_email = 'There was an error with sending the email. Please try again later!';
}
Upravil snakeone (2017-01-10 17:51:17)
Offline
Offline
Kdyby jste se podíval na můj kód tak by jste viděl, že používám smtp gmailu..
Offline
Tak to sa ospravedlňujem, kód som dôkladne neprehliadol. Je mi ale divné že z localhostu vám odoslanie prejde a z hostingu nikoliv. Skúšali ste zapnúť debug v phpmailer aby vám to vypísalo konkrétne chyby? Pred pár rokmi som mal problém z odosielaním z dôvodu zabezpečenia googlu čo sa vyriešili podľa návodu https://support.google.com/accounts/ans … 0255?hl=cs - pri použití dvojfázového overovania som odosielanie cez phpmailer zatiaľ netestoval. Skúste ten debug a napísať sem chybu čo to vrátí aby sa administrátori mohli na to pozrieť.
Offline
DEBUG LOG Z ENDORY:
2017-01-11 09:43:40 Connection: opening to smtp.gmail.com:587, timeout=300, options=array (
)
2017-01-11 09:43:40 Connection: opened
2017-01-11 09:43:40 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP x7sm7594023wjp.18 - gsmtp
2017-01-11 09:43:40 CLIENT -> SERVER: EHLO romansheep.me
2017-01-11 09:43:40 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [88.86.120.207]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
2017-01-11 09:43:40 CLIENT -> SERVER: STARTTLS
2017-01-11 09:43:40 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
2017-01-11 09:43:40 CLIENT -> SERVER: EHLO romansheep.me
2017-01-11 09:43:40 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [88.86.120.207]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
2017-01-11 09:43:40 CLIENT -> SERVER: AUTH LOGIN
2017-01-11 09:43:40 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2017-01-11 09:43:40 CLIENT -> SERVER: ********
2017-01-11 09:43:40 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2017-01-11 09:43:40 CLIENT -> SERVER: ********
2017-01-11 09:43:41 SERVER -> CLIENT: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbuc
534-5.7.14 Alc-c8e-T0Zuagl8CWNg-TaHV6I-MDcs6QRFmOlPTT46CLLQE4qNnrm3DdOErmnjeLNeqp
534-5.7.14 Xz28bxHxfi2TihMIBXhoa3vBWJvqhhNVS029xuap0qdGMiEmx_mlhmnOz8FJyVhCnwF1_5
534-5.7.14 I5iANzCtzFeTkTaqDg4FVlVRkRF0GAsChRmzsv1lo2Y7XlrZqhSkIruaPZ6zdsZDc1-2oU
534-5.7.14 QImMICx4ksdqpH76O5KmlGth2t0nw> 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 x7sm7594023wjp.18 - gsmtp
2017-01-11 09:43:41 SMTP ERROR: Password command failed: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbuc
534-5.7.14 Alc-c8e-T0Zuagl8CWNg-TaHV6I-MDcs6QRFmOlPTT46CLLQE4qNnrm3DdOErmnjeLNeqp
534-5.7.14 Xz28bxHxfi2TihMIBXhoa3vBWJvqhhNVS029xuap0qdGMiEmx_mlhmnOz8FJyVhCnwF1_5
534-5.7.14 I5iANzCtzFeTkTaqDg4FVlVRkRF0GAsChRmzsv1lo2Y7XlrZqhSkIruaPZ6zdsZDc1-2oU
534-5.7.14 QImMICx4ksdqpH76O5KmlGth2t0nw> 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 x7sm7594023wjp.18 - gsmtp
2017-01-11 09:43:41 SMTP Error: Could not authenticate.
2017-01-11 09:43:41 CLIENT -> SERVER: QUIT
2017-01-11 09:43:41 SERVER -> CLIENT: 221 2.0.0 closing connection x7sm7594023wjp.18 - gsmtp
2017-01-11 09:43:41 Connection: closed
2017-01-11 09:43:41 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
DEBUG LOG Z LOCALHOSTU:
2017-01-11 09:46:15 Connection: opening to smtp.gmail.com:587, timeout=300, options=array (
)
2017-01-11 09:46:15 Connection: opened
2017-01-11 09:46:16 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP bf2sm7547297wjc.48 - gsmtp
2017-01-11 09:46:16 CLIENT -> SERVER: EHLO localhost
2017-01-11 09:46:16 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [195.113.101.210]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
2017-01-11 09:46:16 CLIENT -> SERVER: STARTTLS
2017-01-11 09:46:16 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
2017-01-11 09:46:16 CLIENT -> SERVER: EHLO localhost
2017-01-11 09:46:16 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [195.113.101.210]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
2017-01-11 09:46:16 CLIENT -> SERVER: AUTH LOGIN
2017-01-11 09:46:16 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2017-01-11 09:46:16 CLIENT -> SERVER: ********
2017-01-11 09:46:16 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2017-01-11 09:46:16 CLIENT -> SERVER: ********
2017-01-11 09:46:17 SERVER -> CLIENT: 235 2.7.0 Accepted
2017-01-11 09:46:17 CLIENT -> SERVER: MAIL FROM:<2468@centrum.cz>
2017-01-11 09:46:17 SERVER -> CLIENT: 250 2.1.0 OK bf2sm7547297wjc.48 - gsmtp
2017-01-11 09:46:17 CLIENT -> SERVER: RCPT TO:<romakcz@gmail.com>
2017-01-11 09:46:17 SERVER -> CLIENT: 250 2.1.5 OK bf2sm7547297wjc.48 - gsmtp
2017-01-11 09:46:17 CLIENT -> SERVER: DATA
2017-01-11 09:46:17 SERVER -> CLIENT: 354 Go ahead bf2sm7547297wjc.48 - gsmtp
2017-01-11 09:46:17 CLIENT -> SERVER: Date: Wed, 11 Jan 2017 10:46:15 +0100
2017-01-11 09:46:17 CLIENT -> SERVER: To: Joe User <romakcz@gmail.com>
2017-01-11 09:46:17 CLIENT -> SERVER: From: fgkljglkdjg <2468@centrum.cz>
2017-01-11 09:46:17 CLIENT -> SERVER: Subject: dsjfhkjsf
2017-01-11 09:46:17 CLIENT -> SERVER: Message-ID: <01f27be18c739af411a8ca780a727dd4@localhost>
2017-01-11 09:46:17 CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.22 (https://github.com/PHPMailer/PHPMailer)
2017-01-11 09:46:17 CLIENT -> SERVER: MIME-Version: 1.0
2017-01-11 09:46:17 CLIENT -> SERVER: Content-Type: multipart/alternative;
2017-01-11 09:46:17 CLIENT -> SERVER: boundary="b1_01f27be18c739af411a8ca780a727dd4"
2017-01-11 09:46:17 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2017-01-11 09:46:17 CLIENT -> SERVER:
2017-01-11 09:46:17 CLIENT -> SERVER: This is a multi-part message in MIME format.
2017-01-11 09:46:17 CLIENT -> SERVER:
2017-01-11 09:46:17 CLIENT -> SERVER: --b1_01f27be18c739af411a8ca780a727dd4
2017-01-11 09:46:17 CLIENT -> SERVER: Content-Type: text/plain; charset=us-ascii
2017-01-11 09:46:17 CLIENT -> SERVER:
2017-01-11 09:46:17 CLIENT -> SERVER: dfglkslkf
2017-01-11 09:46:17 CLIENT -> SERVER:
2017-01-11 09:46:17 CLIENT -> SERVER:
2017-01-11 09:46:17 CLIENT -> SERVER: --b1_01f27be18c739af411a8ca780a727dd4
2017-01-11 09:46:17 CLIENT -> SERVER: Content-Type: text/html; charset=us-ascii
2017-01-11 09:46:17 CLIENT -> SERVER:
2017-01-11 09:46:17 CLIENT -> SERVER: dfglkslkf
2017-01-11 09:46:17 CLIENT -> SERVER:
2017-01-11 09:46:17 CLIENT -> SERVER:
2017-01-11 09:46:17 CLIENT -> SERVER:
2017-01-11 09:46:17 CLIENT -> SERVER: --b1_01f27be18c739af411a8ca780a727dd4--
2017-01-11 09:46:17 CLIENT -> SERVER:
2017-01-11 09:46:17 CLIENT -> SERVER: .
2017-01-11 09:46:19 SERVER -> CLIENT: 250 2.0.0 OK 1484127971 bf2sm7547297wjc.48 - gsmtp
2017-01-11 09:46:19 CLIENT -> SERVER: QUIT
2017-01-11 09:46:19 SERVER -> CLIENT: 221 2.0.0 closing connection bf2sm7547297wjc.48 - gsmtp
2017-01-11 09:46:19 Connection: closed
admin edit: zacenzurovány citlivé informace
Offline
Dobrý den, jak psal kolega, zdá se že je prolém v oprávněních, viz 2. krok https://support.google.com/mail/answer/ … cantsignin
Offline