Programmation » SMTP2GO : mail envoyé avec la classe phpmailer mais rien d...
SMTP2GO : mail envoyé avec la classe phpmailer mais rien d...
Publié le 09/04/2020 @ 17:34:09,
Par ihirweBonjour,
ça fait quelques jours que je n' arrive pas à comprendre pq le mail est envoyé mais rien n'est dans ma boîte de réception.
Pourriez vous me dire ce qui ne marche pas si vous ayez le temps de regarder:
voici la configuration :
-------------------------
voici le lien de l'application : https://github.com/panique/huge
/**
* EMAIL_USED_MAILER: Check Mail class for alternatives
* EMAIL_USE_SMTP: Use SMTP or not
* EMAIL_SMTP_AUTH: leave this true unless your SMTP service does not need authentication
*/
'EMAIL_USED_MAILER' => 'phpmailer',
'EMAIL_USE_SMTP' => true,
'EMAIL_SMTP_HOST' => 'mail.smtp2go.com',
'EMAIL_SMTP_AUTH' => true,
'EMAIL_SMTP_USERNAME' => '[snip]',
'EMAIL_SMTP_PASSWORD' => '[snip]',
'EMAIL_SMTP_PORT' => 465,
'EMAIL_SMTP_ENCRYPTION' => 'ssl',
/**
* Configuration for: Email content data
*/
'EMAIL_PASSWORD_RESET_URL' => 'login/verifypasswordreset',
'EMAIL_PASSWORD_RESET_FROM_EMAIL' => 'no-reply@example.com',
'EMAIL_PASSWORD_RESET_FROM_NAME' => 'My Project',
'EMAIL_PASSWORD_RESET_SUBJECT' => 'Password reset for PROJECT XY',
'EMAIL_PASSWORD_RESET_CONTENT' => 'Please click on this link to reset your password: ',
'EMAIL_VERIFICATION_URL' => 'register/verify',
'EMAIL_VERIFICATION_FROM_EMAIL' => 'no-reply@example.com',
'EMAIL_VERIFICATION_FROM_NAME' => 'My Project',
'EMAIL_VERIFICATION_SUBJECT' => 'Account activation for PROJECT XY',
'EMAIL_VERIFICATION_CONTENT' => 'Please click on this link to activate your account: ',
merci d'avance
Dernière édition: 10/04/2020 @ 23:55:40
ça fait quelques jours que je n' arrive pas à comprendre pq le mail est envoyé mais rien n'est dans ma boîte de réception.
Pourriez vous me dire ce qui ne marche pas si vous ayez le temps de regarder:
voici la configuration :
-------------------------
voici le lien de l'application : https://github.com/panique/huge
/**
* EMAIL_USED_MAILER: Check Mail class for alternatives
* EMAIL_USE_SMTP: Use SMTP or not
* EMAIL_SMTP_AUTH: leave this true unless your SMTP service does not need authentication
*/
'EMAIL_USED_MAILER' => 'phpmailer',
'EMAIL_USE_SMTP' => true,
'EMAIL_SMTP_HOST' => 'mail.smtp2go.com',
'EMAIL_SMTP_AUTH' => true,
'EMAIL_SMTP_USERNAME' => '[snip]',
'EMAIL_SMTP_PASSWORD' => '[snip]',
'EMAIL_SMTP_PORT' => 465,
'EMAIL_SMTP_ENCRYPTION' => 'ssl',
/**
* Configuration for: Email content data
*/
'EMAIL_PASSWORD_RESET_URL' => 'login/verifypasswordreset',
'EMAIL_PASSWORD_RESET_FROM_EMAIL' => 'no-reply@example.com',
'EMAIL_PASSWORD_RESET_FROM_NAME' => 'My Project',
'EMAIL_PASSWORD_RESET_SUBJECT' => 'Password reset for PROJECT XY',
'EMAIL_PASSWORD_RESET_CONTENT' => 'Please click on this link to reset your password: ',
'EMAIL_VERIFICATION_URL' => 'register/verify',
'EMAIL_VERIFICATION_FROM_EMAIL' => 'no-reply@example.com',
'EMAIL_VERIFICATION_FROM_NAME' => 'My Project',
'EMAIL_VERIFICATION_SUBJECT' => 'Account activation for PROJECT XY',
'EMAIL_VERIFICATION_CONTENT' => 'Please click on this link to activate your account: ',
- <?php
- //Using PHPMailer's namespace
- use PHPMailer\PHPMailer\PHPMailer;
- /**
- * Class Mail
- *
- * Handles everything regarding mail-sending.
- */
- class Mail
- {
- /**
- * @var mixed variable to collect errors
- */
- private $error;
- /**
- * Try to send a mail by using PHP's native mail() function.
- * Please note that not PHP itself will send a mail, it's just a wrapper for Linux's sendmail or other mail tools
- *
- * Good guideline on how to send mails natively with mail():
- * @see http://stackoverflow.com/a/24644450/1114320
- * @see http://www.php.net/manual/en/function.mail.php
- */
- public function sendMailWithNativeMailFunction()
- {
- // no code yet, so we just return something to make IDEs and code analyzer tools happy
- return false;
- }
- /**
- * Try to send a mail by using SwiftMailer.
- * Make sure you have loaded SwiftMailer via Composer.
- *
- * @return bool
- */
- public function sendMailWithSwiftMailer()
- {
- // no code yet, so we just return something to make IDEs and code analyzer tools happy
- return false;
- }
- /**
- * Try to send a mail by using PHPMailer.
- * Make sure you have loaded PHPMailer via Composer.
- * Depending on your EMAIL_USE_SMTP setting this will work via SMTP credentials or via native mail()
- *
- * @param $user_email
- * @param $from_email
- * @param $from_name
- * @param $subject
- * @param $body
- *
- * @return bool
- * @throws Exception
- * @throws phpmailerException
- */
- public function sendMailWithPHPMailer($user_email, $from_email, $from_name, $subject, $body)
- {
- $mail = new PHPMailer;
- // you should use UTF-8 to avoid encoding issues
- $mail->CharSet = 'UTF-8';
- // if you want to send mail via PHPMailer using SMTP credentials
- if (Config::get('EMAIL_USE_SMTP')) {
- // set PHPMailer to use SMTP
- $mail->IsSMTP();
- // 0 = off, 1 = commands, 2 = commands and data, perfect to see SMTP errors
- $mail->SMTPDebug = 0;
- // enable SMTP authentication
- $mail->SMTPAuth = Config::get('EMAIL_SMTP_AUTH');
- // encryption
- if (Config::get('EMAIL_SMTP_ENCRYPTION')) {
- $mail->SMTPSecure = Config::get('EMAIL_SMTP_ENCRYPTION');
- }
- // set SMTP provider's credentials
- $mail->Host = Config::get('EMAIL_SMTP_HOST');
- $mail->Username = Config::get('EMAIL_SMTP_USERNAME');
- $mail->Password = Config::get('EMAIL_SMTP_PASSWORD');
- $mail->Port = Config::get('EMAIL_SMTP_PORT');
- } else {
- $mail->IsMail();
- }
- // fill mail with data
- $mail->From = $from_email;
- $mail->FromName = $from_name;
- $mail->AddAddress($user_email);
- $mail->Subject = $subject;
- $mail->Body = $body;
- // try to send mail, put result status (true/false into $wasSendingSuccessful)
- // I'm unsure if mail->send really returns true or false every time, tis method in PHPMailer is quite complex
- $wasSendingSuccessful = $mail->Send();
- if ($wasSendingSuccessful) {
- return true;
- } else {
- // if not successful, copy errors into Mail's error property
- $this->error = $mail->ErrorInfo;
- return false;
- }
- }
- /**
- * The main mail sending method, this simply calls a certain mail sending method depending on which mail provider
- * you've selected in the application's config.
- *
- * @param $user_email string email
- * @param $from_email string sender's email
- * @param $from_name string sender's name
- * @param $subject string subject
- * @param $body string full mail body text
- * @return bool the success status of the according mail sending method
- */
- public function sendMail($user_email, $from_email, $from_name, $subject, $body)
- {
- if (Config::get('EMAIL_USED_MAILER') == "phpmailer") {
- // returns true if successful, false if not
- return $this->sendMailWithPHPMailer(
- $user_email, $from_email, $from_name, $subject, $body
- );
- }
- if (Config::get('EMAIL_USED_MAILER') == "swiftmailer") {
- return $this->sendMailWithSwiftMailer();
- }
- if (Config::get('EMAIL_USED_MAILER') == "native") {
- return $this->sendMailWithNativeMailFunction();
- }
- }
- /**
- * The different mail sending methods write errors to the error property $this->error,
- * this method simply returns this error / error array.
- *
- * @return mixed
- */
- public function getError()
- {
- return $this->error;
- }
- }
merci d'avance
Dernière édition: 10/04/2020 @ 23:55:40
SMTP2GO : mail envoyé avec la classe phpmailer mais rien d...
Publié le 10/04/2020 @ 10:21:02,
Par maxCes mails sont envoyés avec l'adresse no-reply@example.com ? Ils doivent être dans les spams ou bloqués avant même d'arriver dans ta boite mail.
Dernière édition: 10/04/2020 @ 12:59:04
Dernière édition: 10/04/2020 @ 12:59:04
SMTP2GO : mail envoyé avec la classe phpmailer mais rien d...
Publié le 10/04/2020 @ 13:01:48,
Par maxA tester avec une vraie adresse email dont le SPF du domaine est correctement configuré pour passer par smtp2go:
https://support.smtp2go.com/hc/en-gb/articles/115004408567
ps: je ne vois rien d'anormal dans le code
Dernière édition: 10/04/2020 @ 13:03:18
https://support.smtp2go.com/hc/en-gb/articles/115004408567
ps: je ne vois rien d'anormal dans le code
Dernière édition: 10/04/2020 @ 13:03:18
SMTP2GO : mail envoyé avec la classe phpmailer mais rien d...
Publié le 13/04/2020 @ 19:08:13,
Par ihirweBonjour,
Lorsque je veux à jour le fichier composer.js J'ai ce ci : j'ai toujours le même problème, le mail est envoyé mais rien du tout dans ma boite :
Microsoft Windows [version 10.0.18363.752]
(c) 2019 Microsoft Corporation. Tous droits réservés.
C:\Users\Home>cd C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\huge-3.3.1
C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\huge-3.3.1>composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 25 installs, 0 updates, 0 removals
- Installing phpmailer/phpmailer (v6.1.5): Loading from cache
- Installing symfony/finder (v2.8.52): Loading from cache
- Installing gregwar/captcha (v1.1.8): Loading from cache
- Installing sebastian/version (1.0.6): Loading from cache
- Installing sebastian/global-state (1.1.1): Loading from cache
- Installing sebastian/recursion-context (1.0.5): Loading from cache
- Installing sebastian/exporter (1.2.2): Loading from cache
- Installing sebastian/environment (1.3.8): Loading from cache
- Installing sebastian/diff (1.4.3): Loading from cache
- Installing sebastian/comparator (1.2.4): Loading from cache
- Installing symfony/polyfill-ctype (v1.15.0): Loading from cache
- Installing symfony/yaml (v2.8.52): Loading from cache
- Installing doctrine/instantiator (1.0.5): Loading from cache
- Installing webmozart/assert (1.7.0): Loading from cache
- Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
- Installing phpdocumentor/type-resolver (0.3.0): Loading from cache
- Installing phpdocumentor/reflection-docblock (3.2.2): Loading from cache
- Installing phpspec/prophecy (v1.10.3): Loading from cache
- Installing phpunit/php-text-template (1.2.1): Loading from cache
- Installing phpunit/phpunit-mock-objects (2.3.8): Loading from cache
- Installing phpunit/php-timer (1.0.9): Loading from cache
- Installing phpunit/php-token-stream (1.4.12): Loading from cache
- Installing phpunit/php-file-iterator (1.4.5): Loading from cache
- Installing phpunit/php-code-coverage (2.2.4): Loading from cache
- Installing phpunit/phpunit (4.8.36): Loading from cache
phpmailer/phpmailer suggests installing psr/log (For optional PSR-3 debug logging)
phpmailer/phpmailer suggests installing league/oauth2-google (Needed for Google XOAUTH2 authentication)
phpmailer/phpmailer suggests installing hayageek/oauth2-yahoo (Needed for Yahoo XOAUTH2 authentication)
phpmailer/phpmailer suggests installing stevenmaguire/oauth2-microsoft (Needed for Microsoft XOAUTH2 authentication)
phpmailer/phpmailer suggests installing symfony/polyfill-mbstring (To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2))
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit-mock-objects suggests installing ext-soap (*)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Writing lock file
Generating autoload files
2 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\huge-3.3.1>
C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\huge-3.3.1>C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\huge-3.3.1>
La syntaxe de la commande n’est pas correcte.
C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\huge-3.3.1>
C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\huge-3.3.1>C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\huge-3.3.1>
Lorsque je veux à jour le fichier composer.js J'ai ce ci : j'ai toujours le même problème, le mail est envoyé mais rien du tout dans ma boite :
Microsoft Windows [version 10.0.18363.752]
(c) 2019 Microsoft Corporation. Tous droits réservés.
C:\Users\Home>cd C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\huge-3.3.1
C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\huge-3.3.1>composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 25 installs, 0 updates, 0 removals
- Installing phpmailer/phpmailer (v6.1.5): Loading from cache
- Installing symfony/finder (v2.8.52): Loading from cache
- Installing gregwar/captcha (v1.1.8): Loading from cache
- Installing sebastian/version (1.0.6): Loading from cache
- Installing sebastian/global-state (1.1.1): Loading from cache
- Installing sebastian/recursion-context (1.0.5): Loading from cache
- Installing sebastian/exporter (1.2.2): Loading from cache
- Installing sebastian/environment (1.3.8): Loading from cache
- Installing sebastian/diff (1.4.3): Loading from cache
- Installing sebastian/comparator (1.2.4): Loading from cache
- Installing symfony/polyfill-ctype (v1.15.0): Loading from cache
- Installing symfony/yaml (v2.8.52): Loading from cache
- Installing doctrine/instantiator (1.0.5): Loading from cache
- Installing webmozart/assert (1.7.0): Loading from cache
- Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
- Installing phpdocumentor/type-resolver (0.3.0): Loading from cache
- Installing phpdocumentor/reflection-docblock (3.2.2): Loading from cache
- Installing phpspec/prophecy (v1.10.3): Loading from cache
- Installing phpunit/php-text-template (1.2.1): Loading from cache
- Installing phpunit/phpunit-mock-objects (2.3.8): Loading from cache
- Installing phpunit/php-timer (1.0.9): Loading from cache
- Installing phpunit/php-token-stream (1.4.12): Loading from cache
- Installing phpunit/php-file-iterator (1.4.5): Loading from cache
- Installing phpunit/php-code-coverage (2.2.4): Loading from cache
- Installing phpunit/phpunit (4.8.36): Loading from cache
phpmailer/phpmailer suggests installing psr/log (For optional PSR-3 debug logging)
phpmailer/phpmailer suggests installing league/oauth2-google (Needed for Google XOAUTH2 authentication)
phpmailer/phpmailer suggests installing hayageek/oauth2-yahoo (Needed for Yahoo XOAUTH2 authentication)
phpmailer/phpmailer suggests installing stevenmaguire/oauth2-microsoft (Needed for Microsoft XOAUTH2 authentication)
phpmailer/phpmailer suggests installing symfony/polyfill-mbstring (To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2))
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit-mock-objects suggests installing ext-soap (*)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Writing lock file
Generating autoload files
2 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\huge-3.3.1>
C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\huge-3.3.1>C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\huge-3.3.1>
La syntaxe de la commande n’est pas correcte.
C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\huge-3.3.1>
C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\huge-3.3.1>C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\huge-3.3.1>