Laravel Mail SSL Error - php

while working on my current project, I already started to experience problems after trying to implement the Password Reset function based on the scaffolding that Laravel provides.
Currently, I am only using the default routes and controllers for the password reset procedure.
When it came to testing that functionality, I got the following error:
stream_socket_enable_crypto(): SSL operation failed with code 1
I checked my mail server and I saw that I hadn't yet implemented the new Certificate from Let's Encrypt but was still using a self-signed one. After fixing that issue and also taking care of the intermediate certificate for the Lets Encrypt CA, I checked my server with this tool: https://ssl-tools.net/mailservers/mail.dream-code.eu
This clearly states, that my server is not having any SSL issues anymore, but still, I receive the same message from Laravel when I try to use the Mail function. Is there any known issue about this or do I have to take further steps?
I found something about Laravel 4.2 where you had to change the mail provider from smtpto mail which had fixed the issue for some people but this was also not successful. When I used that mail provider, there was no error but I also did not receive an E-Mail. Neither in the default folder, nor in the spam folder.
When I "manually" send mails via Thunderbird from the same address that is set for Laravel, there is no problem, the E-Mail arrives just a few seconds after sending.
Just in case it's somehow relevant, I try to send to a gmail address. The mail server is a Dovecot/Postfix Combo with the already mentioned Let's Encrypt certificate. PTR Record is configured correctly.

Related

Mail() SMTP Server Response Error

I'm relatively new to creating and sending email messages using php so I could use some guidance from the experts. I've been working on an application for my web site that would allow visitors to place themselves on a mailing list to receive periodic newsletters. As far as I can tell, it should be working. However, I get the following error message when trying to send a test message
Warning: mail() [function.mail]: SMTP server response: 554 Sending address not accepted due to spam.
From what I can see, this problem has been addressed with other questions on this site, essentially indicating that I have somehow found myself on a spamming blacklist run by my hosting server (hostgator). I contacted their technical support group earlier today in an effort to get this resolved. After I explained the problem to them, they asked what SMTP settings I was using. I thought this to be a strange question as I am not sending these messages through Outlook or other email software but directly from my web site using php mail(). Their solution was to provide me with a domain name to use for my incoming and outgoing mail servers as well as specific settings to use.
Here's where the confusion comes in. I'm not sure how I can use this new information in my php code for sending an email. Am I supposed to put some of this information into the headers accompanying the message? As I understand it, using php mail() causes the message to be sent from the host servers and any changes that I make to the email software settings on my home desktop should have no effect. Other than assuming that the individual that I spoke with at hostgator doesn't understand my question and trying to get a different answer from a different technical support specialist, I am at a loss as to what to do. Any suggestions?

Server/Laravel 5.1 - Mail storage?

So I developed an application with laravel and everything is running fine. I had mail as my mail driver but my server was misconfigured, or let's say, postfix was not installed. So the mail a user sent via contact form in my laravel app never got sent. Laravel never complained so I didn't even see any errors in the logs.
My question is: Did laravel or my server save the mail it tried to send anywhere so I could see what the user tried to send me?
Unless you've somehow manually added mail logging, this won't be logged for you to send later.
Laravel's Mail functionality does include a Log driver, so that mail writes to a log- but this does not work in tandem with the other drivers, so you likely have zero logs currently.
http://laravel.com/docs/5.1/mail#mail-and-local-development
There are also several results in google on how to implement global logging for all mail sent, maybe check out this or look into laravel events.

PHP PEAR mail fails using Google Apps mail account - error 535 authentication failed

I have a PHP page that uses PEAR Mail to send a message through a Google Apps mail account. The page is only active in the fall and winter, and it was working great when it was last used in January.
Now, as I prep the site for the fall, this page no longer works. I have the exact same problem as described at SMTP Error 535 (Incorrect authentication data) using PEAR mail There have been no answers to that question and it won't allow me to comment, so I'm starting a new question.
I am using code identical to that posted by pavan kumar at Send email using the GMail SMTP server from a PHP page .
The error message is:
authentication failure [SMTP: Invalid response code received from server (code: 535, response: Incorrect authentication data)]
I double-checked that the login for the mail user had not been changed since January. I copied and pasted the address and password from my script into the Gmail login in my browser. It worked, so I know my parameters are correct. This account is a business domain address, not #gmail.com.
I am trying to connect at:
$host = "ssl://smtp.gmail.com";
$port = "465";
I also tried specifying tls:// and port 587, no luck. I also set the host to "googlemail.com" instead of "gmail.com" per a suggestion in another SO thread.
I did a var_dump() of the $smtp object, and confirmed my address and password were passed into it successfully and accurately.
The account is on a cPanel system that recently upgraded to PHP 5.3.5 and Apache 2.2.22. It seems unlikely that change could have triggered this problem, but I mention it in case it could be a factor.
Edit: Found http://support.google.com/a/bin/answer.py?hl=en&answer=176600 which says "...you must configure an SPF record for your domain with the IP address of the device or application to ensure that recipients do not reject mail sent from it. You must also add this IP address to the Email Whitelist box in your Google Apps control panel. For example. if your sending device sends from 123.45.67.89, add that address to your SPF record without removing the Google Apps mail servers from the record..." Unfortunately I don't have an Email Whitelist box in this domain - it's the free <10 user account which evidently doesn't have that feature.
Edit 2:
Related: http://support.google.com/mail/bin/answer.py?hl=en&answer=78775
Edit 3:
I set up the account in Opera mail, and sent successfully using both AUTH LOGIN and AUTH PLAIN settings.
The problem was located at my web host, not Google's mail server.
The account is on a cPanel server, and the admin had set it so that only designated user accounts could access external SMTP servers. He disabled that requirement in order for me to test, and my mail system immediately started working.
So far, though, I have found no documentation on how to log into cPanel as one of the authorized users when its SMTP Authentication is activated. I will update this if I find some.

Mail an exchange server SMTP server response: 550-Verification failed

How do I send an email to my exchange server? When I set the php.ini file with send_from="x#domain.com" it says 550 verification failed. How do I verify myself?
I am using SMTP: mail.domain.com
Its probably a good idea to use a class like phpmailer http://sourceforge.net/projects/phpmailer/ to do this.
That way if you have multiple projects that need to send via a different account or different servers then you won't have any problems.
The error you're getting is because your exchange server requires authentication and your script isn't using authentication or its using the wrong information. I've never really relied on the built in php sendmail functions so I can't be 100% sure but I don't think it supports authentication. (I might be wrong on that point, but I still recommend a class that you can configure per script over a globally configured mail account)

A couple problems re: CodeIgniter emailer

I have some problems with the email system for CodeIgniter:
First, the emails I send out (registration, confirmations) are getting caught in standard spam filters in gmail and other mail clients. How do I get around this? How do companies like Facebook get their emails through consistently?
Second, the mailer is working locally but once we deploy it it no longer runs (doesn't send emails) but all the other forms run just fine. Anyone ever run into a problem like this?
Thanks for all the help!
I can't really answer your first question - it's not specific to CodeIgniter. You just need to make sure your email doesn't look like spam. In short - there's no way of guaranteeing your e-mail will not end up in a spam filter.
As for the second question, I expect your production server needs to be configured properly for email. You probably need to configure CodeIgniter to send email properly. I would suggest setting up an SMTP server (or using an existing one) rather than using the standard PHP mail which I think CodeIgniter uses by default.
Regarding spam, most organisations are very secretive about how they prevent spam (not wanting to publish information which helps the spammers) and in some cases they don't actually know - an obvious examlpe of this is bayesian filtering - but, for example, hotmail use a completely unaccountable army of volunteers to manually classify emails.
Do and get a copy of spamassassin and try to reverse engineer how the standard rules work. Obvious things to check are:
1) AVOIDING LOTS OF CAPITALS
2) don't mention the 'V' word
3) make sure you've got a current and restrictive SPF 1.0 policy published
4) make sure your sending from an address which has A and PTR DNS records
5) Do provide a reply-to and from email address which use your domain in the address
the mailer is working locally but once we deploy it it no longer runs
doesn't send emails
Which? These are 2 totally seperate things. If the code is falling over (if so why have you not provided the error details) then its likely a PHP version issue or a problem with the connection to the MTA (or the PHP mail config).
The latter is a problem with the MTA itself.
99.9% of problems reported as PHP mail failures have nothing to do with PHP and are problems with the MTA.
Enabled detailled error reporting for your MTA and see where it is failing.
C.
You may have to configure the email on your server differently than your local development environment. I've had to in the past.
There are two basic ways that PHP can send mail:
Via a UNIX program called "sendmail" (only on non-Windows servers and only if it is installed - check with your hosting provider)
Via a SMTP server.
If you've configured CodeIgniter to use SENDMAIL, check to ensure that the Sendmail path is correct. Your hosting provider usually provides this somewhere in their online documentation.
If you're using SMTP, you need to make sure that your server can contact the SMTP server. You can do this by logging into the server via SSH and typing "telnet your.smtpserver.com 25". If you get an error message about not being able to connect, you know you have a problem with your hosting provider connecting to your mail server.
I've been able to diagnose this problem by enabling logging on my production server (http://bit.ly/4pprd6) and adding log_message('error', $this->email->print_debugger()) right after I attempt to send a message.

Categories