I am using Mail Queue to send emails in my application (https://pear.php.net/package/Mail_Queue/)
The same code works fine on windows (php version: 5.5.28) and it gives the below mentioned exception on unix (php version 5.6)
PHP User Notice 'yii\base\ErrorException' with message 'Error in sending mail: authentication failure [SMTP: STARTTLS failed (code: 220, response: Begin TLS negotiation now)]'
The mail server credentials are fine. They are same on linux as well as on windows. Code 220 means the server is ready (via http://www.serversmtp.com/en/smtp-error)
I read somewhere it is due to php5.6 and it will work fine on 5.5 but I don't think so that would be a valid answer/solution to the problem.
I guess this is because PHP 5.6 does SSL peer verification by default and PHP 5.5 doesn't. I guess if you fix a valid SSL certificate it should work, or disable ssl verify-peer in your code.
Without knowledge of Mail_Queue I don't know how to fix it without any example code.
Sending emails from EC2 instances is limited by Amazon and strictly throttled at network level. This is to prevent spamming and other abuses.
If you have a large amount of emails to send to your customers, the recommended way is to use Amazon Simple Email Service. With Amazon SES, you can send transactional email, marketing messages, or any other type of high-quality content and you only pay for what you use.
Connecting to the Amazon SES SMTP Endpoint
If you really need to send emails from an EC2 instance, you must use an Elastic IP Adress and ask Amazon's support to remove limitations on SMTP traffic from that EIP.
Alternatively I will suggest you can use Sendgrid, they are fast and accurate, provides 12000 emails per month for free as well.
Related
I have setup a Website based on HTML with the exception of a contact.php page. I am hosting this website on my Rasberry Pi 3 computer on Debian flavor of linux Jesse Light. This is headless as it hosts my Portfolio website. I am using Apache2 webserver and installed sendmail as my Mail Transfer Agent (MTA). The problem is I have been spinning my wheels researching for the past week and I am stuck.
My issue is I send email from my php contact page on my live server but nothing ever arrives in my inbox after sending it. I get a mail sent message from my php script after about a minute after sending but then Nothing arrives in the inbox. I am thinking My SMTP on my php.ini is not correct. I put my website domain name FQ name. I am using Microsoft Exchange Online hosted email domain by GoDaddy. Also, anyone have any good advise on what my from / to should be set to on my SMTP configurations?
Sounds like a direct reject to me.
Some hints:
check the SMTP logs from your MS Exchange server (if a connection has been opened and potentially been refused for whatever reason)
check the PHP / Apache logs and see, whether an PHP fatal error or warning occured (mybad bad credentials or wrong port?)
I have had bad experiences with MS Exchange server and SMTP, make sure its proper setup.
check the credentials and settings from an independent client to see if they work flawless.
Hope that helps. Otherwise please provide more details and log samples.
Is your contact.php program hosted on the Godaddy server? If yes- It's not possible to send mail through Godaddy shared hosting servers using your own SMTP settings. You can only send from Godaddy's relay server when using a shared hosting plan. If you wanted to be able to send through your own SMTP servers, you'd need to be hosting with either a VPS or Dedicated Server plan.
Check maillog on your server and you will get the smtp connection timeout errors.
Let me know, in case the problem is something different- will try to address it.
I am using Amazon EC2 Instance for one of my project, I have installed LAMP on linux server and now while I am trying to send email using simple function it is not sending email also is not giving any error for that.
Things I have done so far.
Created SES account.
Used simple mail function.
Enabled port 25 in security groups.
I solved this issue just by installing sendmail in my instance. Just run bellow command in your terminal
sudo apt-get install sendmail
That worked for me
If you are using a amazon ec2 ami/linux distro use "sudo yum install sendmail" while in SSH
Although your problem relates to Sendmail have you tried following Amazons Documentation?
http://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-smtp-app.html
This uses postfix but it seems like a better alternative and there's help readily available for it.
You also can use SMTP as Amazon SES supports this:
http://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-smtp.html
I know this doesn't directly answer your question. You might just need to configure the mail settings in php.ini.
If you are using AWS SES you need to make sure you validate the account first:
http://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-email-addresses.html
With the exception of addresses containing labels (see below), you must verify each email address that will be used as a "From" or "Return-Path" address for your messages.
The entire email address is case-sensitive. For example, if you verify sender#example.com, you cannot send emails from sender#EXAMPLE.com unless you verify sender#EXAMPLE.com also. (Domain verification, however, is case-insensitive. For more information, see Verifying Domains in Amazon SES.)
Until you are granted production access to Amazon SES, you must also verify the email address of every recipient except for the recipients provided by the Amazon SES mailbox simulator. For more information about the mailbox simulator, see Testing Amazon SES Email Sending. For more information about production access, see Requesting Production Access to Amazon SES.
Alternatively, instructions mentioned in the following link can be followed. In this method installing postfix, sendmail or any other mail server is not required.
It uses the PHPMailer class to send email through Amazon SES using the SMTP interface.
https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-using-smtp-php.html
It took me a whole day to reach this simpler solution.
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)
I have an IIS server running PHP on an Apache Module. I am running a domain on it, and this domain has a seperate setup for email which uses an exchange server. When I try to send email from the website using php mail() the exchange server rejects it. I.e. the header from line is sender#this-domain.com and it is sending to receiver#this-domain.com, both are email addresses set up in the exchange, even though the sender has no direct relationship with exchange.
The emails are not getting through. We tried using a Yahoo adress in the from line but nothing. Has anyone ever come across a problem like this.
You have to either configure the exchange server to accept relay requests based on the origin ip or some transparent authorization mechanism (don't know much about IIS and Exchange and integrated windows authentication, but the good people over at http://serverfault.com do. ). Or use some mailing library that can handle smpt authentication like e.g. http://swiftmailer.org
I once ran into a problem like this which involved the Exchange server not wanting to accept anonymous connections or that it would only accept mail from certain SMTP servers. Have you checked the configuration on your Exchange server to eliminate those possibilities?
I have developed flex based application with php. My client is using Windows 2003 Server. I installed IIS Server and Php Installer into my client machine. I configured php into IIS Server and its working fine.
Query:
I wrote a mail code for sending mail to my application user. My client is using internal mail server. I want to send a mail through my application. I used smtp.gmail.com into my application and Its working perfectly. But when I am using client internal mail server. It is showing below mentioned error.
"Failed to set sender [SMTP: Invalid response code received from server. (Code: 554, response: Mail from mail-id rejected for policy reasons.]"
Please help me out to solve this query. Thanks in advance.
Well, why not to ask client's system administrator about "policy reasons"?
This should be no PHP problem but rather a problem with the SMTP server or a misconfiguration of the SMTP settings in your application. SMTP servers can be equipped with a lot of security features (I think that's what they mean with policy reasons) to allow or deny sending emails through that server from specific hosts, from specific uses, with specific authentication mechanisms, to specific domains, to specific users, etc. (list can be continued endlessly). Contact the responsible system administrator for that SMTP server and ask him what settings you need to feed into your SMTP mailer in your application.