For one of my clients I use PHPMailer for handling messages coming from the website.Some time ago he told me that not all messages were coming through. I added my own e-mail address as BCC (which I told the client) and saw a lot of messages coming through. He told me though, that he was called by some customers, telling him that they had sent messages from the website, which he say, he never received.
Is there a way to check if messages were sent that didn’t come through? Or is there any alternative for PHPMailer. Not sure what to do. It’s his word against mine
You could look for some logging options, but IME that would only tell you that they had been delivered to the SMTP server to be sent, not that they had actually been delivered. You can request an acknowledgement, but the receiver can decline to send one.
You really need an example of a client who should have received the email but did not, to narrow down where the problem lies. If you’re sending it and they don’t receive it, in many ways that’s just “one of those things” with email. Any number of intermediates could be spam-trapping, for example.
You only can reliable check mail sending if you use SMTP (because that directly connects you with the mail server). Then you can check the mail server logs for failed messages. It might also help to add a bounce address (a recipient that is notified if sending fails).
Since I do not use PHPMailer, you’ll have to check its documentation were to find that.
Whilst not actually fixing the problem I wonder if a solution could be to add an autoreply on the inbox it is being delivered to. Then when a user submits the contact form you could put a message saying ‘you will receive an email shortly confirming your email has reached our inbox. If you don’t hear from us within 24hrs please drop us a line’.
obviously useful to know what is causing the problem if you can find it but this should be a catch all anyway.
the problem is with a success message is where it is triggered from. If it’s done straight after the php_mailer send completes then that doesn’t mean that the email was successfully sent it just means that the php_mailer script completed. Hence my reason for suggesting an autoreply on the actual inbox the email is going to as that would definitely only trigger if the email arrived.
No I don’t have. I remember getting an error message on the SMTP part. I have a question thought. Should the user and password be from that particular e-mail account or can it be any other one on the same server?
The idea with PHPMailer, SwiftMailer and all the others is that you use the mail server to send the emails, so you need to provide the credentials for your mail server, ie a valid email address and password for the mail server rather than for your hosting account.
I’m not sure how the mail is getting sent if you don’t have this.
I’m not sure what you mean by this particular email address, but I found (by trial and error) that on my install the from email address needs to be the same as the one I’m using to connect to the mail server. I don’t know if it’s the same for all installations.
You can see just what is going on by enabling verbose debugging:
What i mean is. In a lot of examples/tutorials they advise you to use gmail.smtp because your website can be blacklisted, for what ever reason. So even if the email address where messages are send to is email@example.com can I still use the cridentials from a gmail account?, This is confusing me a lot
Ah yes. I can see the confusion. If you’re going to use Gmail’s SMTP then you need to use a Gmail email address and password. It’s not something I have tried, but I suggest you set verbose debugging and suck it and see…
Happy you understand the confusion When I use his own mail server I can make an extra address on the server and use those cridentials, but it’s very hard to ask the client for his GMail cridentials or can i even use my own cridentials?
You can use any. The only thing that you need to understand is that it has to be correct to the tee. You cannot use an email and randomly decide that it uses tls and not ssl. If the configurations says it’s supposed to use ssl, then you have to use ssl. There is no if’s, and’s, or’s, or but’s when dealing with SMTP. It has to be exact configuration. Also, make sure that the email address you are using actually can send messages using PHP. Some hosters have disabled sending email messages unless the email address is registered under your actual domain and is verified to be a valid email address.