So I was reading the last section of this page and it talks about knowing if there's a problem sending an email.
As a test, I use:
my personal Gmail acct (I got the email on this one)
a fake email using the company domain (e.g. myfakeemailhere123456789#companyB.com). I know it's going to be fake since our company uses some standards for their email address.
and both resulted in returning a blank array.
Any ideas what I could be doing wrong?
edit: I'm using postfix that's locally installed in the server.
Swiftmailer ist only for sending mails,
so if you have an issue sending the email you could make use of try/catch
BUT it will not receive any mails, so you will not be able to receive and react to a bounce-mail (the mail that will be returned by your company-webserver if the adress doesnt exist)
Related
I recently performed a parallel update from phplist 2.10.12 to 3.0.12. We kept the old version operational while the client became accustomed to the new one in demo mode. Today we switched to 3.0.12 and turned off demo mode, and we're having difficulty with the test emails.
phplist is configured to send two test emails, one in text and one in html. When sending a test to me, both emails are sent (and are put in spam), and phplist announces that they were sent successfully. When sending a test email to the client, however, only the text message is sent successfully. When changing the setting to only send one email, phplist announces that sending failed, and indeed no email shows up.
The client is indeed capable of receiving html emails at that address, and the error log says Error sending email to [email address] Could not instantiate mail function. However, to reiterate, it did send correctly to me - twice. But it fails every time sending to the client.
I am unfamiliar with configuring phplist, and any help here would be appreciated. Thanks!
Edit: from config.php:
# To use a SMTP server please give your server hostname here, leave it blank to use the standard
# PHP mail() command.
define("PHPMAILERHOST",'');
I have a script set up that will email a user an activation link when they insert their email into the provided input.
I'm using CodeIgniter's email class to send the multipart emails and the problem I'm having is that when the email is sent, the debugger says that the email was sent sucessfully but the message is never received.
When I send the email to my internal work email, it sends just fine. But when I send it to my gmail account, it never comes through.
I've managed to track down the issue as being a problem with inserting links within the email. When I remove the link, the email sends fine. I put the link back in and the email is never received by my gmail account.
Has anyone ever come accross this problem or do you have any insight into how to fix this?
your email is being rejected.. this is no CI issue..
Ok, so it sounds like the problem isn't with CodeIgniter or your code, but with the server's mail transfer agent sending it on to the Gmail server.
What happens is CodeIgniter puts together an email and gives it to the PHP engine, which passes it on to the mail transfer agent on the server for sending. The MTA will report back to PHP, and therefore CodeIgniter, that it has received the email properly. As PHP & CodeIgniter's jobs are finished at this point, they will report that they've sent successfully.
Check your spam folder in your Gmail to see if it's been put in there..? I haven't used CI for a while so can't remember exactly, but I think there's an HTML-email parameter you may need to set before you send. If so, Gmail might be expecting this to be set too.
Scroll down to 'Email Preferences' here:
http://codeigniter.com/user_guide/libraries/email.html and set the mailtype to HTML.
If that doesn't work, you will need to debug fully.
To debug the problem properly you will need to be able to access the MTA logs. Is this a local development server or a live production machine? Is it Linux or Windows? If Linux, which distribution? Do you know which MTA you are using? Do you have SSH access to the server?
If you can get SSH access and find out which MTA you have things will be a lot simpler to find out and you'll be able to monitor the outgoing messages and the destination servers' responses as they happen.
The project that I'm currently working on, is large scale. I'm using email activation method for user registration system: Sending activation code via my shared hostings smtp server to users email address after successful signup.
During tests, I have noticed that, it sends emails to famous mail services like gmail, live without any problem and receiver gets message directly but when I tried to send email to well known email server (rambler.ru), the swiftmailer script (that I'm using to send emails) returned success message. BUT another side didn't received any message. That's big problem for me.
At first I thought maybe that's scripts problem. Tried phpmailer too. No success. Then tried to send from Outlook to that server for testing purposes. The user on rambler.ru received message with very big delay. I'm using shared hosting on Hostgator. There might be users that using rambler.ru server, and I dunno if that's one and only server that occurs such problem.
How to deal with that problem? I know that, I can send from live or gmail servers with "fake" from name. But another problem, is there will be probably daily limit or something like that. Any suggestions?
Check your SMTP server's logs to see what happened to the email. Getting TRUE from mail() or swiftmailer just means that they've successfully handed the email off to your smtp server. It does NOT mean that the email was delivered to the receiving host. That comes later, AFTER your php script has exited.
I'm using PHP mailer to as part of an enquiry form that I'm building for a client. One thing I've noticed in testing is that when I use my yahoo account as the FROM and my gmail as the to it works fine for a while but then it starts rejecting, I'm assuming because gmail is smart enough to know that the email isn't actually coming from Yahoo.
What is the best solution to this? I could use the email from the person who has actually filled in the form to show as the FROM address but I'm worried that this may eventually cause the same problem anyway? I could also send it from an email on the domain that its sending from but will that stop it from appearing as spam or black listing that email?
Any help or guidance would be great?
You are getting tagged as a spammer because you are sending the same message over and over. Set up your own mail server without a spam filter while developing if this is a problem.
You are not Yahoo -- don't pretend to be them! Set the From field to an address at the domain that's sending the mail (e.g, if your domain was example.com, send from something like inquiries#example.com or noreply#example.com).
This is probably related to SPF records. mail() will most likely try and send the mail directly to the server(s) identified by the MX record of the recipient domain, and because you are not sending from an IP address that is recognised as one of Yahoo's, Google will reject the email. If you are on *nix, you may be able to configure your system's sendmail program to relay via Yahoo. This is not an option on Windows (I don't think) because Windows has no sendmail and PHP will send the mail itself.
If you want a cross-platform solution you can use something like PEAR::Mail to relay the message through Yahoo's SMTP servers - this should resolve the problem as long as the SPF record is the source of the problem.
If your email is getting flagged as spam because of the content of the message, the only solution is to change the content of the message.
I have set up an AJAX contact form on a client's website.
The problem is that the email is not getting through to the client's inbox.
I set up the client with Google Apps (in the same way I did for myself).
I used the same contact form with my email address and it works. But with any email addresses on their domain it doesn't!
All members of the domain are receiving 'ordinary' emails.
What could be the difference that's stopping mail() emails getting through?
UPDATE
Ok so I managed to solve it. Turns out that using a CNAME to point the domain to the correct server wasn't enough for sendmail so I had to change it to an A record pointing directly to the server. Strange but true. Thanks for the help folks, you pointed me in the right direction :)
It depends on the both settings on your server and the server on the receiving end.
hotmail for example requires the use of correctly configured SPF records.
many mail-receiving servers (including hotmail) require the email to originate from a Fully Qualified Domain Name. It is very possible that your e-mails send from PHP do not comply with this rule. (there is a good chance they originate from 'apache')
see hotmail self help and hotmail postmaster info
PHP's mail() function does not include a lot of headers with your mail, so you will need to supply them yourself.
The more hops your mail makes on it's way to it destination, the more likely it is to be tagged as spam.
So it might be a better option not to use PHP's mail function and instead use a mail library that connects to an SMTP server just like your desktop mail application does.
All in all, I would place my bets on an external library: Pear::Mail (documentation)
You could also read: how do you make sure email you send programmatically is not automatically marked as spam
UPDATE
Failing the SenderId or SPF check can get your message dropped before it even hits the users inbox. The message will not end up in the users junk folder, it will go directly to /dev/null.
I know this is at least true for hotmail and live mail. I see no reason for other hosts not to have implemented the same policy.
I recommend using PHPMailer (including their SMTP) library instead. It is reliable compared to mail and allows you to create fully customized emails.
http://phpmailer.worxware.com/