Skip to content
This repository has been archived by the owner on Jan 25, 2021. It is now read-only.

Sending validation email. #44

Closed
halojoy opened this issue Jul 19, 2015 · 13 comments
Closed

Sending validation email. #44

halojoy opened this issue Jul 19, 2015 · 13 comments

Comments

@halojoy
Copy link
Contributor

halojoy commented Jul 19, 2015

I know that my send email works. I just use the php mail() function. I have set the email correctly in Addictive;
smtp.alltele.net
port 25
TLS
But the mailing does not work. I have tried changing the settings in every possible way. Still I get this error:
"Mailer Error: You're unable to send e-mails. Check your SMTP settings"
I am sure it would work with mail(), but you use a more complicated email class.

@brunnopleffken
Copy link
Owner

I'm using PHPMailer as e-mail client, the Email() class (in kernel/Email.php) is more like an abstraction class to define settings, etc. I tested it using my two e-mail accounts in Gmail and Outlook.com. I'll try to do another tests, check if there's a newer version of PHPMailer released, etc.

@halojoy
Copy link
Contributor Author

halojoy commented Jul 20, 2015

I will test using port 465. I did test 25 and 587, but both gave error.
But I have my own software and can send mail() without any problem. So, I find it strange it does not work. I have of course the setting in php.ini = smtp.alltele.net and port = 25

Port 465 did not work. Now I have tested 25,465,587 with no luck.

@halojoy
Copy link
Contributor Author

halojoy commented Jul 20, 2015

    // Check if e-mail information is empty
    if($config['general_email_smtp'] == "" ||
       $config['general_email_authentication'] == "" ||
       $config['general_email_username'] == "" ||
       $config['general_email_password'] == ""
    ) {
        Html::Error("<b>Mailer Error:</b> You're unable to send e-mails. Check your SMTP settings in "

Of course I leave auth, username and password empty.
I do not use authentication for to send email.

@brunnopleffken
Copy link
Owner

Nice! Turning these lines into:

// Check if e-mail information is empty
if($config['general_email_smtp'] == "" ||
   $config['general_email_authentication'] == ""
) {
    Html::Error("<b>Mailer Error:</b> You're unable to send e-mails. Check your SMTP settings in "

...everything works fine?
If it does, can you send a PR?

@halojoy
Copy link
Contributor Author

halojoy commented Jul 21, 2015

If you want to test for empty, then you should first see if Auth is set.
After this you have one test for Auth,username,password and one without which dows not test this.

I have finally got Validation mail to work.
The problem was in this line:
//$this->Mail->SMTPAuth = $config['general_email_authentication'];
var_dump of that variable shows a String 5 chars: "false"
which is not the same as false.

This works: $this->Mail->SMTPAuth = false;
So, you should test if string is = "true" or "false" to determine the boolean value.

@halojoy
Copy link
Contributor Author

halojoy commented Jul 21, 2015

TLS or SSL.
TLS is better. It is a replacement for SSL.
SSL is deprecated and should not be used generally.
I suggest you take away the choice of TLS/SSL and use only TLS.

@brunnopleffken
Copy link
Owner

Two fixes sent:

  • Convert string to boolean ("false" is considered TRUE because it's not an empty string);
  • Username and password can be left blank.

Try to run git pull and see if this is enough to make Email() work with your server environment.

About the TLS, yeah, TLS is the most common one, but it's set this way by default, and I think it's nice to let the possibility to choose between one another.

Thanks!! ;)

@halojoy
Copy link
Contributor Author

halojoy commented Jul 21, 2015

When storing false and true in a MySQL TEXT field,
it is a good idea to use "0" and "1".
The string "0" is interpreted as false in PHP. (Also of course an empty string can be used.)
I did see you have several other fields with "false" and "true"

@brunnopleffken
Copy link
Owner

I started to perform this, change all true/false strings to 0/1 (still strings though). The database and Admin CP is already migrated, but I still need to change the controllers (they're validating == "true" and == "false")... I gave a break, but I want to finish this in the next few hours!

@halojoy
Copy link
Contributor Author

halojoy commented Jul 22, 2015

Hello.
I have a slightly modified version with 0.7.0, where I got email working.
Today I downloaded and installed 'development' version.
Installation went fine. But I can not get Email validation to work.
It is very strange.
I use mail->SMTPDebug = 2
And the output of debug shows only good. But no email comes in my inbox.
mail->send() returns true.

Here is output of SMTPDebug:
2015-07-22 17:07:30 SERVER -> CLIENT: 220 smtp.alltele.net ESMTP IceWarp 11.2.0.1 x64; Wed, 22 Jul 2015 19:07:30 +0200 2015-07-22 17:07:30 CLIENT -> SERVER: EHLO 188.122.128.27 2015-07-22 17:07:30 SERVER -> CLIENT: 250-smtp.alltele.net Hello 188.122.128.27 [188.122.128.27], pleased to meet you. 250-ENHANCEDSTATUSCODES 250-SIZE 41943040 250-EXPN 250-ETRN 250-ATRN 250-DSN 250-CHECKPOINT 250-8BITMIME 250-AUTH PLAIN LOGIN DIGEST-MD5 CRAM-MD5 GSSAPI 250-STARTTLS 250-VRFY 250 HELP 2015-07-22 17:07:30 CLIENT -> SERVER: STARTTLS 2015-07-22 17:07:30 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS 2015-07-22 17:07:30 CLIENT -> SERVER: EHLO 188.122.128.27 2015-07-22 17:07:30 SERVER -> CLIENT: 250-smtp.alltele.net Hello 188.122.128.27 [188.122.128.27], pleased to meet you. 250-ENHANCEDSTATUSCODES 250-SIZE 41943040 250-EXPN 250-ETRN 250-ATRN 250-DSN 250-CHECKPOINT 250-8BITMIME 250-AUTH PLAIN LOGIN DIGEST-MD5 CRAM-MD5 GSSAPI 250-VRFY 250 HELP 2015-07-22 17:07:30 CLIENT -> SERVER: MAIL FROM:<> 2015-07-22 17:07:30 SERVER -> CLIENT: 250 2.1.0 <>... Sender ok 2015-07-22 17:07:30 CLIENT -> SERVER: RCPT TO: 2015-07-22 17:07:30 SERVER -> CLIENT: 250 2.1.5 ... Recipient ok; will forward 2015-07-22 17:07:30 CLIENT -> SERVER: DATA 2015-07-22 17:07:30 SERVER -> CLIENT: 354 Enter mail, end with "." on a line by itself 2015-07-22 17:07:30 CLIENT -> SERVER: Date: Wed, 22 Jul 2015 17:07:30 +0000 2015-07-22 17:07:30 CLIENT -> SERVER: To: halojoy 2015-07-22 17:07:30 CLIENT -> SERVER: From: 2015-07-22 17:07:30 CLIENT -> SERVER: Subject: [ADDICTIVE DEV] New Member Validation 2015-07-22 17:07:30 CLIENT -> SERVER: Message-ID: 2015-07-22 17:07:30 CLIENT -> SERVER: X-Priority: 3 2015-07-22 17:07:30 CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.8 (https://github.com/PHPMailer/PHPMailer/) 2015-07-22 17:07:30 CLIENT -> SERVER: MIME-Version: 1.0 2015-07-22 17:07:30 CLIENT -> SERVER: Content-Type: text/html; charset=iso-8859-1 2015-07-22 17:07:30 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit 2015-07-22 17:07:30 CLIENT -> SERVER: 2015-07-22 17:07:30 CLIENT -> SERVER: Hello honolulu,

Before you can start posting in ADDICTIVE DEV, you must confirm your e-mail address. Please, confirm your e-mail address by clicking on the link below:

http:///register/validate?m=8&token=1126bfb31206cb978dcb77a9d0ef2a93

If you cannot click on the link, copy and paste the address into your browser manually.

Thanks. See you there!
Administration 2015-07-22 17:07:30 CLIENT -> SERVER: 2015-07-22 17:07:30 CLIENT -> SERVER: . 2015-07-22 17:07:30 SERVER -> CLIENT: 250 2.6.0 793 bytes received in 00:00:00; Message id 201507221907308875 accepted for delivery 2015-07-22 17:07:30 CLIENT -> SERVER: QUIT 2015-07-22 17:07:30 SERVER -> CLIENT: 221 2.0.0 smtp.alltele.net closing connection

@brunnopleffken
Copy link
Owner

Weird... Reading the log, seems like you've successfully sent the message.
Changing the SMTP server, does everything work fine? Does it happen only with this specific server?

@halojoy
Copy link
Contributor Author

halojoy commented Jul 23, 2015

Yes, everything looks fine.
I explained in my last pull request.
I had empty mail->From in my config.
Most mail servers will not accept sending without a from email.
But I have fixed a check in my pull request.

@brunnopleffken
Copy link
Owner

Nice. This seems to be solved then!
Thanks!!!

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

No branches or pull requests

2 participants