-
-
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
SMTP connect() failed. #270
Comments
This is a problem with permissions somewhere outside PHPMailer. At a guess I'd say your php.ini does not allow the use of |
You could try setting |
Synchro, I have tried the above suggestion by keeping $mail->SMTPDebug = 4; and using tls on 587, and here is the error, I am getting
Is their a chance that and I am (my gmail account) not allowed to use smtp.gmail.com. Also, for you reference I am putting my code below (removing password, and only the part which is responsible for sending mail, not the whole)
|
Also, when using localhost for sending mail, I am getting suscess message
So, again I doubt that my user is not allowed to use the smtp.gmail.com server, though I have POP/IMAP enabled. |
Typically there are no restrictions on doing anything on localhost. I suspect you may be running into a system-level policy, such as SELinux or AppArmor, see this question and this posting, both of which suggest it's a system-level problem. |
hi there include 'class/class.phpmailer.php' ; $mail= new PHPMailer(); $mail->IsSMTP(); $mail->SetFrom("secret"," secret"); $address = "secret" ; $body .= ""; $mail->MsgHTML($body); i can't recognize why it dose not work |
You're not looking very hard since you are not using the code provided on this site, nor have you read the documentation either. |
thank you ! you could solve my problem . |
Hi to all, i have this problem often i see SMTP Error: Could not connect to SMTP host but from a server Hostinger, how would recommend me ? |
Try to remove the $mail->IsSMTP(); |
No, don't do that. Setting |
It's an incredibly, but I remove $mail->IsSMTP(); and all work fine |
This is like saying that a broken light bulb works perfectly when it's switched off. |
Just a simple question relating to SMTP and PHPMailer. Is it true that if you comment out the I currently use GoDaddy as my website hosting platform (which I believe is what someone else was referring to when he/she said "s***** hosting company") and when I tried to use Gmail SMTP authentication via PHPMailer, it did not work (apparently the SMTP request never left the GoDaddy servers). Once I commented out the |
Yes, and it's all entirely logical. SMTP-related settings are only applicable when using SMTP, including GoDaddy blocks outbound mail connections (to gmail and everywhere else), so you need to use GoDaddy's own mail servers, which may include localhost. Obviously your gmail login attempts will not work on GoDaddy's servers, though it's a good way of telling them your gmail password if your'e not paying attention. This is also why you should not disable SSL verification. It's faster because you're not trying to connect to somewhere that's blocked, not because it's a faster sending mechanism. As I said, the most effective way to send is via SMTP to localhost (or a nearby smarthost), which avoids all the issues you've mentioned. The from address limitation is a gmail restriction, nothing to do with PHPMailer nor GoDaddy. |
Hi, I have an error for connecting to SMTP...
I've tried with this setting using Codeigniter : And I'm using local server using XAMPP... |
@21accel You need to use the latest PHPMailer, and read the troubleshooting guide. Please don't hijack unrelated tickets. |
Yes I had use the latest version that I just downloaded some days ago... |
You can't have been using a recent version - all releases in the last year or so include a link to the troubleshooting guide in error output, and yours did not show that. This was hijacking because you posted your query on a closed ticket that had a completely different symptom than you were seeing. |
From the http-side, how can I get som informaion from SMTPDebug? I have PHPMailer on a standrad web-hotel without consol access, just ftp. |
If you set SMTPDebug to anything > 0 (2 is probably what you need), it will output an SMTP transcript to standard output, so it will just appear as normal page output. It's worth disabling any redirects after sending or you may not get to see the output. Just set it in your code before uploading. |
OK, but if I would like to have the output to a variable like I can do with |
Sure, just inject your own callable for the
That way all the debug output will accumulate in the |
Thank You!!! |
But.... To get the Deugoutput, shall I do like this: |
OK, forget the last post... |
At most I get this:
And this must be before the password and everyting else that can go wrong I suppose? |
Just looks like your mail server is dead:
|
Actually that IP address is not internet-accessible because it's in an RFC1918 range, so it's impossible to connect to it unless you're on the same network already. |
Well, I have my web space at their (one.com) server, so I am at the same network in some way even if I have my own domain. |
Does your server have a |
one.com is a big actor, and I don't thing they kan have a mail-server down for several hours. But I've sent a mail to their support. |
But it was like you said :-) The server was down and now it's working just fine. |
Hi @dickrex and anybody else :), Also I dont get any error if it comes to $mail->send (not even with SMTPDebug = 4, no timeout just loading and waiting). I would really appreciate it if you could post your settings or help otherwise. Thank you! |
Hi @Hagenzone Please use the below config, as it works for me, and i am also using it. require 'PHPMailer-master/class.phpmailer.php'; $mail = new PHPMailer(); |
Hi @Msz900, thank you for posting your code. Unfortunately this code does not work. I suppose its because your configuration is for gmail, not for one.com which seems to need a slightly more different config. But thank you anyway! |
@Msz900 Do not post incorrect, obsolete, unsafe code. It doens't help anyone, especially when it doesn't address the problems of the original poster. |
@Synchro exactly, GitHub isn't StackOverflow, lol. |
The one.com-support helped me out. Here is the configuration that worked for me: smtp: true Hope this one can help somebody. |
for gmail you must turn on access to 3rd party apps https://www.google.com/settings/security/lesssecureapps // turn it on |
@darkworks don't post incorrect and irrelevant comments please. It is not a requirement to enable less secure apps in gmail, and the OP isn't using gmail anyway. |
* Added handling of fatal errors in Send Email Test page. * Added setting to allow the use of SMTP servers with invalid SSL setup. [More information](PHPMailer/PHPMailer#270) * Added SAR_FSMTP_DEBUG_MODE and SAR_FSMTP_ALLOW_INVALID_SSL constants, check FAQ for more details.
@mqasim1990 - that "fix" is mentioned and described in detail above, and is covered in the PHPMailer docs, which are linked to from the error message you got. Don't hijack year-old tickets to add duplicate and misleading information. |
Hi,
I am using the gmail smtp server (smtp.gmail.com), with my gmail (free) username and password but each time I am getting the following error
I have tried with both tls (port=587), and ssl (port=465), but got the same error
The text was updated successfully, but these errors were encountered: