-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PhpMailer doesn't sent mail in some cases #348
Comments
Pleae don't use PHPMailer Lite. there is no advantage in doing so, it's out of date, buggy and no longer supported, at least by me. Aside from that, most email providers (particularly yahoo and gmail) do not allow you to set arbitrary from addresses. You can pre-configure aliases in gmail, but you can't just use anything as it looks like forgery. |
Thank you Synchro for your answer. I'm now trying to use gmail SMTP but my web hoster apparently blocks connection on port 465, i'll call them to find out what to do! Meanwhile, any suggestions for the problem i'm having?? Thanks |
Read the docs, base your code on the examples provided. Don't use SSL on port 465; use tls on port 587. By arbitrary, I mean anything other than gmail or yahoo addresses on each service respectively. |
I followed exactely the gmail example but i still get an error:
I'm only including class.phpmailer.php and class.smtp.php, but i don't think it's the issue!! and here is my code:
|
If you're including those two classes, you're not following the example. This isn't a PHPMailer problem - it's your gmail account. Have you tried doing what it suggests? Following that link? |
Yes, I followed the links but it redirects me to my personal email instead of the email I used in $mail->Username to signup with!! And don't you think it's caused by a misconfiguration in the server? or even something I should set in gmail account? |
Following the links shows now some info about the correct gmail account, but it only shows some account info... P.S. I'm now using PHPMailerAutoload.php :D |
You will need to sign out of your personal account and sign in with the one you're sending through. Probably worth googling the message as well. |
that's exactly what I did!! |
Well, it's a reliable (usually!), well-specified SMTP service and many people already have an account, so it's quick and easy to set up. It also means that you don't need to have a local mail server running to send mail from PHP - though of course you can use any server for that. |
OK, well, i'm so confused now, don't know if the problem comes from the server, or from the gmail account!! |
No, gmail is pretty standard SMTP - all you need is tls on port 587 and use normal auth. This answer seems like a likely solution: http:https://stackoverflow.com/a/20645752/333340 |
I have already tried all the changes mentioned in the link you sent me!! |
OMG, it's a real nightmare!! as soon as I signed out from the gmail account, the problems starts again!! |
Did you see the comment in that question about allowing app access in gmail? If you do use port 25 on 1&1, make sure it lets you use tls as well otherwise it's not worth using. |
Yes, "Access for less secure apps" is enabled!! I was using port 25 with tls when it worked for few minutes... |
Hi, 2- if the email is being sent by someone through the contact form, WE MUST use the following: with this, we can be sure to receive all emails... as per the smtp.gmail, i finaly made it work again, but it was always showing the @gmail.com in "sender" field, i added a new email address i can send mails from, but in this case, it shows "sent via gmail" ! Hope this will help people who were in the same situation as me! To be continued and a special thank you to Synchro for his help ;) |
Yes - this is what I meant about not allowing arbitrary addresses, and reply-to is the appropriate workaround. It's quite right that they should do this, as if you say it's from the submitter, it's straight forgery (because they never sent the email message, you did) and it's becoming increasingly likely that the email will be blocked by their SPF settings anyway. |
I'm thinking to use Mandrill with phpMailer, what do you think about it? |
No particular feelings either way, but PHPMailer works well with it. |
Well, i'm just happy the problem is solved :) thanks ;) I'll have some very few questions please, I would love to have your opinion: 2- what's the recommender $mail->Priority to use? 3- when using $mail->msgHTML() do we still need to add $mail->isHTML(true); ?? Thanks a lot ;) |
|
1- I didn't find any info about doctype... :/ 2- OK |
The doctype determines whether you're talking HTML4, XHTML or HTML5 for the rest of the document, so it sets the context for all other markup. Head tags are stripped in some clients (possibly hotmail), and some spam filters like the title tag to match the subject line. I suggest you make your HTML as clean and valid as possible - it's much easier fixing small problems from that position. Doctype, head and title are all required for valid HTML of any flavour, so leave them in, and do what they say - so don't use XHTML makup in HTML5, or vice versa. |
Great, thanks for the explanations... ;) |
Hi Synchro, I'll have one last question please. Thanks |
Just wrap a condition around it and enable/disable it in your config? You could try running a fake SMTP server, there are some links in the examples folder - I use https://github.com/Nilhcem/FakeSMTP |
Thanks for the fast reply |
The code that calls PHPMailer, something like: if ($config['enable_email']) {
$mail = new PHPMailer;
...
} |
Ah Ok, i see the idea |
Whatever works for you. If you're not going to send you could just skip the message building steps too. |
OK, thanks you very much and have an amazing week end ;) |
I spent the whole morning trying to figure out why last night I was able to send email using PHPMailer just fine and now it does not work, but thanks to this conversation I found the problem. ..Hi, 2- if the email is being sent by someone through the contact form, WE MUST use the following: .. Thank you for posting this Redani, I will never forget this one for sure. |
You're very welcome deifos ;) |
@Redani, thank you for your solution.
I was using |
You're very welcome, and glad it helped you ;) |
I am using PHPMAILER. when I am sending the email through PHPMAILER to the Email id like [email protected] it is not receiving at recipient end. Can somebody help me here. |
@Parvezkhan you need to define "not working" and read the troubleshooting guide. Please don't post comments on unrelated, closed tickets. |
getting "Could not access file".. path of attachment is correct.. |
I'm getting really crazy trying to figure out what's going on with phpmailer :/
I'm using phpMailer Lite 5.1, then i downloaded phpMailer (not Lite) and still the same problem!
here is a portion of my code:
With the first SetFrom, it workds perfectly, but when someone sends me an email from contact form, SetFrom should contain his email, in that case, it does'nt work all the time... And the worst thing is that, it doesn't output any error message!
I also have just noticed that if SetFrom is set to my yahoo email address, i receive a "Undelivered Mail Returned to Sender" email !! :/
Do you please have an idea of what that might be??
Thanks a lot for your help
The text was updated successfully, but these errors were encountered: