Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email trouble #27

Open
zotz opened this issue Jan 13, 2021 · 9 comments
Open

Email trouble #27

zotz opened this issue Jan 13, 2021 · 9 comments

Comments

@zotz
Copy link

zotz commented Jan 13, 2021

I am having some odd email trouble.

using a test account at ethereal.email, emails seem to work fine.

PHPMailer configuration $mail = new PHPMailer(true); $mail->isSMTP(); $mail->Host = 'smtp.ethereal.email'; $mail->SMTPAuth = true; $mail->Username = 'some.account77@ethereal.email'; $mail->Password = '1234xqzCE9TtzsagWH'; $mail->SMTPSecure = 'tls'; $mail->Port = 587;

All emails seem to go our properly, but this account is not suitable for wider testing, only for a very first test.

Using another account/server for phpmailer, this time ssl on port 465, the register and verify emails never show up but the password reset emails do show up.

Any thoughts on the best way to go about troubleshooting this would be welcome. I don't have access to the email server logs as far as I can tell.

@msaad1999
Copy link
Owner

This is a very troublesome topic, since I have encountered a lot of similar problems and most of the time it was related to problems with the SMTP server (For example, google accounts causes a lot of problems in applications like these a lot).
Your issue, however, seems to be a bit different since only some emails are showing up for you. Just to verify, can you send a couple more emails and verify that you specifically can only get the password-reset emails?
The email configurations are the same for all emails sent by the application, so there is theoretically no reason for only some of them to pass through. Try looking the problem on the SMTP server you are using

@zotz
Copy link
Author

zotz commented Feb 25, 2021

I am fairly certain I was using an email account associated with godaddy and using their mail server for the problem testing I reported. I may have been missing something, but I could not find a way to track down what was going on on that end.

In the end, I have up and began using an old yahoo email account I had and then things worked.

If I get back around to that project again soon, I will try and remember to test again and report back.

@msaad1999
Copy link
Owner

Just to help out, my experience with hosting email accounts have involved some problems with these type of applications as well. Do verify if you are using the correct SMTP servers, and if the problem of only specific emails being received persists, contact customer support. It is likely that some emails were blocked, and the hosting support might help in figuring out what was different/dangerous in those emails.
To my knowledge, all emails are sent with the same functionality with the only differences being email subject and message body, so there should be nothing explicitly different between any email's content.

@pcodesdev
Copy link

I am getting an error message of "email could not be sent, try again later"
Every time I try to verify any account. Kindly assist

@xazes
Copy link

xazes commented Aug 29, 2021

same for me "email could not be sent, try again later"

@wintstar
Copy link

Have the correct data been inserted here?

Edit the file assets/setup/env.php and setup the Application information, Database connection and SMTP server. Port value is usually not needed in Database connections, so only edit if you know what you are doing. The email server (and the connected email account) will be used to send confirmation, validation and notification emails.

if (!defined('MAIL_HOST')) define('MAIL_HOST', 'smtp.gmail.com');
if (!defined('MAIL_USERNAME')) define('MAIL_USERNAME', 'example.email@gmail.com');
if (!defined('MAIL_PASSWORD')) define('MAIL_PASSWORD', 'example-password');
if (!defined('MAIL_ENCRYPTION')) define('MAIL_ENCRYPTION', 'ssl');
if (!defined('MAIL_PORT')) define('MAIL_PORT', 465);

@xazes
Copy link

xazes commented Aug 29, 2021

yes its correct. i test it with another programm but is it possible it has problems with self signed ssl cert?
Or is there a log output?

@xazes
Copy link

xazes commented Aug 29, 2021

I try it now with my gmx account and it works. thx seems with my smtp is anything not correct.

@themeONE808
Copy link

themeONE808 commented Sep 23, 2021

this is what i did to figure out why my SMTP server settings where not working.
(ended up being due to a mismatched SSL certificate from my hostgator reseller account. the solution for me was to edit \assets\setup\env.php and change the hostname for MAIL_HOST to the active sub.domainname.com[i was using localhost before] and it worked fine. but this can help you understand YOUR underlying smtp/email issues)

this is what i did to troubleshoot PHPMAILER smtp issues in this app
edit the file(s) below:

file to edit: \verify\includes\sendverificationemail.php

edits to make:
1)
$mail->isSMTP();

change to

$mail->isSMTP();
$mail->SMTPDebug = 2;

**note: you can also set SMTPDebug = 4; if you want it to give full debug info including login credentials. (use during development only)
2)
// for public use
$_SESSION['STATUS']['verify'] = 'email could not be sent, try again later';

change to

    // for public use
    $_SESSION['STATUS']['verify'] = 'email could not be sent, try again later. ERROR: ' . $mail->ErrorInfo;

!!dont forget to revert the changes once youre done troubleshooting.

also to get the verify process to complete(email link was invalid) i had to make the additional change:

$url = "localhost/loginsystem/verify/includes/verify.inc.php?selector=" . $selector . "&validator=" . bin2hex($token);

changed to

$url = "domainname.com/verify/includes/verify.inc.php?selector=" . $selector . "&validator=" . bin2hex($token);

not sure if this was the correct place to change it but everything worked after that.

basically you can login and goto domainname.com/verify/ and it will give you a chance to resend validation email. once the debug is set on it should spew out the connection info. (if for some reason you need to re-verify youre account just open the users database and set your users 'verified_at' value back to null and it should let you send another code to the email.
let me know if this wasnt clear or any other questions.
-themeONE

ps: thanks for the nice work on this project @msaad1999

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants