Phpmailer Error Failed To Connect To Server Connection Refused 111
Contents |
Sign in Pricing Blog Support Search GitHub This repository Watch 656 Star 7,312 Fork 4,188 PHPMailer/PHPMailer Code Issues 48 Pull requests 11 smtp error failed to connect to server connection refused 111 godaddy Projects 0 Wiki Pulse Graphs New issue SMTP ERROR: Failed to connect failed to connect to server connection refused 111 smtp connect failed to server: Connection refused (111) with Office365 #295 Closed ndub opened this Issue Oct 11, 2014 · wordpress smtp error: failed to connect to server: connection refused (111) 8 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 4 participants ndub commented Oct 11, 2014 Sorry if this is phpmailer godaddy gmail a road heavily traveled. I've seen the other posts about this but nothing in them has either solved the problem I'm having or ignited a lightbulb that helped me solve it myself. Here's my code: require 'PHPMailerAutoload.php'; $config = parse_ini_file('/path/to/file/config.ini', true); $mail = new PHPMailer; $mail->SMTPDebug = 3; $mail->Debugoutput = 'html'; $mail->isSMTP(); $mail->Host = $config['host']; //smtp.office365.com $mail->SMTPAuth = true;
Failed To Connect To Server: Connection Refused (111) Gmail
$mail->Username = $config['username']; //an.existing.account@appinc.co $mail->Password = $config['password']; //confirmed this is being passed correctly $mail->SMTPSecure = 'tls'; $mail->Port = 587; $mail->From = $config['username']; $mail->FromName = 'Website Forms'; $mail->addAddress('sales@appinc.co', 'Some Name'); $mail->addReplyTo('sender.email@somedomain.com', 'SenderFirst SenderLast'); $mail->addBCC('my.email.address@appinc.co'); $mail->isHTML(true); $mail->Subject = 'Contact Form Submission'; $mail->Body = 'Some html here'; $mail->AltBody = 'Some alt content here'; if(!$mail->send()) { echo 'Mailer Error: ' . $mail->ErrorInfo; } else { //perform success actions exit(); } I've confirmed that the domain, username and password are all correct and being passed in correctly. Important to note that this worked on our local dev server prior to launch. Once the site was moved to our hosting account (Hostgator) is when it stopped working. I've confirmed with HG that port 587 is open on our server. Here is the error message I'm seeing: Connection: opening to smtp.office365.com:587, t=10, opt=array () SMTP ERROR: Failed to connect to server: Connection refused (111) SMTP connect() failed. Message could not be sent.Mailer Error: SMTP connect() failed. Any help that can be provided is very much appreciated, even if it's just
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and
Phpmailer-with-godaddy-smtp-email-server-script-working
policies of this site About Us Learn more about Stack Overflow the smtp connection refused on port 25 company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags godaddy phpmailer smtp connect() failed Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only https://github.com/PHPMailer/PHPMailer/issues/295 takes a minute: Sign up PHPMailer: Using remote SMTP server, works under localhost, Connection refused (111) on remote server up vote 4 down vote favorite 1 I've got a bizarre problem here. I'm trying to use PHPMailer to send an email, through SMTP. I have a website hosted by GoDaddy and it's that SMTP account that I'm trying to use to http://stackoverflow.com/questions/21668488/phpmailer-using-remote-smtp-server-works-under-localhost-connection-refused send the mail. It works if I execute my PHP file on my localhost server. It does not work if I execute my PHP file on GoDaddy's server. The error message I get is: SMTP -> ERROR: Failed to connect to server: Connection refused (111) I checked phpinfo on both localhost and the remote server. Both have smtp_port listed as 25. I'm using WAMP on my machine and the server is some form of Linux (which I know nothing about and have no idea how to administer). Here is the code in question: INDEX.PHP: SMTPDebug = 1; $mail->Port = 25; $mail->IsSMTP(); $mail->Host = 'smtpout.secureserver.net'; $mail->SMTPAuth = true; $mail->Username = 'username@site.com'; $mail->Password = 'super_secret_password'; $mail->SMTPSecure = ''; // tried ssl and tls, with same result $mail->ClearAddresses(); $mail->AddAddress('receiver@hotmail.com', 'Receiver Name'); $mail->From = "username@site.com"; $mail->FromName = "Username"; $mail->Subject = 'Hi there'; $mail->Body = "This is a message"; if ($mail->Send()) { echo "Message sent!\n"; } else { echo "Message failed!\n"; print_r($mail->ErrorInfo); } exit(); ?> php email smtp phpmailer share|improve this question asked Feb 10 '14 at 3
that make connections all over the world. Join today Download & Extend Drupal Core Distributions Modules Themes PHPMailerIssues https://www.drupal.org/node/900638 SMTP -> ERROR: Failed to connect to server: Connection refused (111) on PHPMailer Closed (duplicate)Project:PHPMailerVersion:6.x-2.2Component:MiscellaneousPriority:NormalCategory:Support requestAssigned:kwjavReporter:kwjavCreated:September 2, 2010 - 15:33Updated:September 2, 2010 - 19:31 Log in or register to update this issue After module installation I can't get the PHPMailer to send any email; always end up with the SMTP -> ERROR: Failed connection refused to connect to server: Connection refused (111) I'm using a gmail app account and these are the settings: Primary SMTP server: smtp.gmail.com SMTP Port: 465 Protocol: SSL with authentication (user and password triple-checked) Using PHP classes 5.0.2 (as it is the latest tested version) Hosting is Godaddy, PHP 5.2 Linux installation -- What failed to connect I tried: Use a @gmail account instead of my domain from google apps but nothing. All combinations of Port and Protocol to no avail. Installed SMTP module along with PHPMailer module; same results. Cleared caches - reinstalled module; idem. http://drupal.org/node/831870 This is a similar issue for "SMTP authentication support" module that ends up in installing PHPMailer as an option and works fine. What can be blocking (or refusing) my connection is unknown to me. Any help will be greatly appreciated. Comments Comment #1 smk-ka CreditAttribution: smk-ka commented September 2, 2010 at 5:36pm Status: Active ยป Closed (duplicate) Same as #805834: SMTP -> Error: Failed to connect to server: Connection timed out (110) and SMTP Error: Could not connect to SMTP host. In short, your hosting provider is blocking connections with a firewall. You need to open port 465 to be able to connect to Google Mail. Log in or register to post comments Comment #2 kwjav CreditAttri