bcit-ci / CodeIgniter

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
18.28k stars 7.62k forks source link

Error trying to send a mail #3538

Closed Azakur4 closed 9 years ago

Azakur4 commented 9 years ago

When i try to send a mail with code igniter 3 rc this give me this error:

A PHP Error was encountered

Severity: Warning

Message: fwrite(): SSL operation failed with code 1. OpenSSL Error messages: error:140D00CF:SSL routines:SSL_write:protocol is shutdown

Filename: libraries/Email.php

Line Number: 2131

Backtrace:

the same code work that generated that error is working well in code igniter 2.0

MrGate commented 9 years ago

do you have ssl enabled on your server?

narfbg commented 9 years ago

This is a networking or SMTP configuration issue, not a CI bug.

Azakur4 commented 9 years ago

i use the same code same configuration for smtp in code igniter 2 and work, now in code igniter 3 this doesn't work how this can be a problem of networking or smtp server if code igniter 2 work?

narfbg commented 9 years ago

Just because you haven't yet encountered the issue in CI2 it doesn't mean that it can't happen with it as well. Google around and you'll see that all kinds of PHP projects are having the same issue, specifically with Gmail and SMTP.

Azakur4 commented 9 years ago

the problem is that i have a project using code igniter 2 this project use the email library and works fine. Now i make a copy of this project and upgrade it to ci 3.0rc using the guide posted in the doc online and now the email library doesn't work for me.

i do test in code igniter 2 using tsl and ssl and is working fine in smtp servers from zoho provider now i try to do the same test in the project that i copy before and doesn't work.

i do tests to changing the newline and crlf parameters too, well i only think is this is not a bug maybe in code igniter 2 this was a functional bug or this change in ci 3 im trying to figure out what change in this library from ci 2.0 to 3.0.

im testing this 2 projects in the same server!

narfbg commented 9 years ago

Look, I understand that this has worked for you in CI2, but that doesn't necessarily mean it's a bug in CI3.

If you can prove that claim with a technical explanation - that's fine, but all the current info that I have on that error points to configuration/authentication/network issues. I don't have your environment and configuration and it's impossible for me to test with it so I can't give you more info either (and I'm not here to do that anyway).

Post a topic about it on the forums and you might find somebody to help you out there.

narfbg commented 9 years ago

1025 might be related though.

dipDevDave commented 9 years ago

So I have just updated my CI project to version 3. Everything is working great except the emails.

I have created a test function to send emails and i output the debugger and part of the response prints:

Failed to send AUTH LOGIN command. Error: Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

I have kept the same configuration file as my CI2 project. Is that alright?

NOTE: This has only been tested on my local environment.

Any help would be much appreciated

Dhaval-dswtpl commented 9 years ago

Don't send me email next time

On 5/19/2015 11:49 AM, davidpisani wrote:

So I have just updated my CI project to version 3. Everything is working great except the emails.

I have created a test function to send emails and i output the debugger and part of the response prints:

Failed to send AUTH LOGIN command. Error: Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

I have kept the same configuration file as my CI2 project. Is that alright?

NOTE: This has only been tested on my local environment.

Any help would be much appreciated

— Reply to this email directly or view it on GitHub https://github.com/bcit-ci/CodeIgniter/issues/3538#issuecomment-103353824.

avinashseth commented 9 years ago

is there any solution for this? I'm losing a good amount of time, as i want to update my app to ci 3.0

dipDevDave commented 9 years ago

I just replaced the new email library with the old library so the file in system/libraries/Email.php. It doesnt seem like the best solution but i spent days and days trying to fix it and nothing worked. This was the only solution for me. Let me know how you go.

DaTebe commented 8 years ago

@dipDevDave I encounter the exact same problem. Replacing the new CI3 library with the old one worked. But that can not be the solution. I looked what the print_debugger() said. I was surprised, that also in the old CI2 Email-Library it says email_failed_smtp_login. But then the following happens:

hello: 250-mcsrv03.mydomain.intra Hello [192.168.10.110]
250-SIZE
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-AUTH NTLM LOGIN
250-X-EXPS GSSAPI NTLM
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250-XEXCH50
250 XRDST
</pre>lang:email_failed_smtp_login<br />
<pre>from: 250 2.1.0 Sender OK
</pre><pre>to: 250 2.1.5 Recipient OK
</pre><pre>to: 250 2.1.5 Recipient OK
</pre><pre>to: 250 2.1.5 Recipient OK
</pre><pre>data: 354 Start mail input; end with <CRLF>.<CRLF>
</pre>250 2.6.0 <5649ea8957886@mydomain.de> Queued mail for delivery
<br /><pre>quit: 221 2.0.0 Service closing transmission channel
</pre>lang:email_sent

The smtp server sends the email. The email was send to another host. Only valid logged in users can send emails to external hosts. If someone has a hint, I would be very happy

EDIT: Is it possible, that in the old CI2 email class after an failed AUTH LOGIN a fallback without credentials is performed? I found a hole in our email system that allows sending mails without login.

kanad-pa commented 8 years ago

Hi all,

Even we had the same issue using CodeIgniter 3 and thanks to @dipDevDave we were able to resolve the issue by overwriting the system library with CI 2.0 file.

I had to search a lot and this was the only solution that worked so @narfbg, it's clearly an issue with CodeIgniter and not PHP / network related as we tested using PEAR SMTP email code and that worked flawlessly, but only CodeIgniter 3 code did not work.

It's however worth noting that sometimes the email would be sent but it would happen only just after server restart and never again.

We are using GoDaddy Workspace email via SMTP.

Thanks!

SirDre commented 8 years ago

Ref: http://stackoverflow.com/questions/27622427/codeigniter-2x-email-class-smtp-ssl-verification-bug-on-php-5-6