I am stumped.
I am using Laravel's Password::remind, which has already been written for me, so there is nothing that I have changed:
try {
$reset = Password::remind($credentials);
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
When I submit the form, then I receive the following exception:
Exception
Connection could not be established with host localhost [Connection refused #61]
Which points to my throw exception line above
In my app/config/mail.php file, I have tried everything from mail to sendmail, from localhost to smtp.gmail.com - whatever I change in this config file, Laravel still thinks that it is localhost. Even tried "/usr/sbin/sendmail -t -i"
I have restarted apache and fpm - the error does not change.
When I try mail(email, title, message) - it works just fine. Of course, my goal is to not just send an email but to use Laravel's Password::remind - function where it sends an email with a link for the user to reset their password.
I have changed the /usr/local/etc/php/5.5/php.ini file, both the smtp and smtp_port
What do I need to do, this seems so straight forward in their documentation and no one else has complained about this issue for connection refused # 61. There are other connection refused and they have nothing to do with the built in Password::remind. This is driving me nuts.
I am running fpm-nginx.
Thanks in advance
Just to be on the safe side in respect to any configuration issues, I suggest you to try your application in a closed environment such as Homestead. This way, i.e. by relying on a fresh virtual machine, you might be able to figure out whether it is a configuration issue on the level of the different applications (apache, php, etc.) you are using. Otherwise, you would have to reinspect your code again. You can find more information on Homestead here: http://laravel.com/docs/4.2/homestead
OK, there were a couple of configurations that had to be in place and I am posting this answer in case anyone else using Yosemite is having this issue.
First, from my searching for the error "Connection refused #61" this is usually related to connectivity with a database as Korush suggested above. However, if I typed in an email that was not part of the database, Laravel would come back with a message that such and such email was not found, which told me that it was connected to the database, from the stand point of searching the email that was entered.
However, if a person does not have a "password_reminders" table in their localhost database, then a person would receive a connection refused error - be sure that you have this for Laravel to use in your localhost db:
CREATE TABLE password_reminders (
email VARCHAR(50) NOT NULL,
token VARCHAR(100) NOT NULL,
created_at TIMESTAMP
)
Second, Laravel can use the mail server on your system. In my case, I am using Yosemite, which has "postfix" available in the terminal:
sudo postfix start
Here is my local config which allows Laravel to use the "password_reminders" table, which is located in app/config/database.php:
'local' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'yourdb',
'username' => 'yourusername',
'password' => 'yourpassword',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
Within the app/config/mail.php:
'driver' => 'smtp',
'host' => 'localhost',
'port' => 25,
'from' => array('address' => 'service#yourdomain.com', 'name' => 'Your Company'),
'encryption' => '',
'username' => null,
'password' => null,
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
I still need to figure out how to get the redirects and messages to display, but this is working for the emailing a link to reset the password:
public function request()
{
$message = "";
$session = null;
$request = array('email' => Input::get('USER_EMAIL'));
Password::remind(Input::only('USER_EMAIL'), function($message)
{
$message->subject('Password Reminder');
});
if ($request == 'reminders.sent') {
$session = 'message';
$success = true;
$message = 'Email with further instruction has been sent to "' . Input::get('USER_EMAIL'). '".';
return Password::remind($request);
} elseif ($request == 'reminders.user') {
$session = 'error';
$success = false;
$message = 'Email Address: ' . Input::get('USER_EMAIL') . ' WAS NOT FOUND!';
return Password::remind($request);
}else{
$message = 'Not meeting either condition "' . Input::get('USER_EMAIL') . '".';
return Password::remind($request);
}
Session::flash($session, $message);
return Redirect::to('/').with($session, $message);
}
Here are my routes related to password remind:
Route::get('password/reset', array(
'uses' => 'PasswordController#remind',
'as' => 'password.remind'
));
Route::post('password/reset', array(
'uses' => 'PasswordController#request',
'as' => 'password.request'
));
Route::get('password/reset/{token}', array(
'uses' => 'PasswordController#reset',
'as' => 'password.reset'
));
Route::post('password/reset/{token}', array(
'uses' => 'PasswordController#update',
'as' => 'password.update'
));
Maybe it is trying to send an e-mail and it is not working.
I'm using Silex SwiftmailerServiceProvider.
Now i need to send an email from my website but i keep getting this error.
I searched all over the place but i find only the #110 errors etc.
The code i'm using at the moment:
$message = \Swift_Message::newInstance()
->setSubject('[OFFERTE]' . $data['name'])
->setFrom(array('fromemail'))
->setTo(array('myemail'))
->setBody($data['comment'],'text/html');
$app['mailer']->send($message);
This code above is the code inside my page.php (landing page).
$app->register(new Silex\Provider\SwiftmailerServiceProvider(), array(
'swiftmailer.options' => array(
'host' => 'host',
'port' => 'port',
'username' => 'username',
'password' => 'password',
'encryption' => null,
'auth_mode' => null
)
));
The code above here is what's in my bootstrap.php (if you're familiar with silex).
Anyone an idea what might be the source of this error?
Thanks!
Pieter-Jan
EDIT: i did fill in the host etc in boostrap.php
For all others who are having the same issue i had...
If you're getting this message you are doing something wrong. The problem i was having is that some data was wrong to make the connection. So triple check the data you need.
$mailboxes =
array(
'label' => 'Mail',
'mailbox' => '{mail.example.com:143/novalidate-cert}INBOX',
'username' => "myadress#mail.com",
'password' => "mypassword"
);
imap_open($mailboxes['mailbox'], $mailboxes['username'], $mailboxes['password'])
I have caught this error when I use imap_last_error() :
"Connection failed to mail.example.com,143: Connection timed out"
But when I have tried it in localhost (Wampserveur), everything works fine.
Note: extension=php_imap.dll is enable on my serveur.
I'm trying to open a XMPP connection between my server and the Google Cloud Connection Server (CCS), but it doesn´t work. I´m programming with PHP and using the JAXL library. Here is my code:
<?php
include_once 'jaxl.php';
$client = new JAXL(array(
'jid'=>'<my_sender_ID>#gcm.googleapis.com',
'pass'=>'my_API_key',
'auth_type'=>'PLAIN',
'host' => 'gcm.googleapis.com',
'port' => '5235',
'force_tls' => true
));
$client->start();
echo "done";
?>
And then I get this error:
unable to connect tcp://gcm.googleapis.com:5235 with error no: 110, error str: Connection timed out
what am I doing wrong?
You should connect to gcm.googleapis.com by ssl, not http or tcp.
I fixed this by modifying jaxl.php from:
public function get_socket_path() {
return ($this->cfg['port'] == 5223 ? "ssl" : "tcp")."://".$this->cfg['host'].":".$this->cfg['port'];
}
to:
public function get_socket_path() {
return ($this->cfg['port'] == 5223 || $this->cfg['ssl'] == true ? "ssl" : "tcp")."://".$this->cfg['host'].":".$this->cfg['port'];
}
After that you can initialize the client with:
$client = new JAXL(array(
'jid' => '<your-API-key>#gcm.googleapis.com',
'pass' => '<your-API-key>',
'host' => 'gcm.googleapis.com',
'port' => 5235,
'force_tls' => true,
'auth_type' => 'PLAIN',
'strict' => FALSE,
'ssl' => TRUE
));
Also, when you initialize the client, use
'log_level' => JAXL_DEBUG
That will allow you to see everything that's sending or being received. In my case, I figured out that my project has not yet been whitelisted - I forgot to register it on https://services.google.com/fb/forms/gcm/
jaxl_socket_client:189 - 2013-10-04 08:11:58 - <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><temporary-auth-failure/><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Project 1012343798740 not whitelisted.</text></failure>
Perhaps you should change the host to http://gcm.googleapis.com. Your error says "unable to connect tcp://gcm.googleapis.com:5235".
GCM Cloud Connection Server (CCS) is an XMPP endpoint, running on http://gcm.googleapis.com port 5235.
I'm trying to send an email using CakeMail.
I'm using Wamp Server, ok?
My email.php is this:
public $gmail = array(
'host' => 'ssl://smtp.gmail.com',
'from' => array('support#xxx.com' => 'xxx'),
'port' => 465,
'transport' => 'Smtp',
'username' => 'igorpoxxx#gmail.com',
'password' => 'xxx',
);
In My controller:
App::uses('CakeEmail', 'Network/Email');
$Email = new CakeEmail('gmail');
$Email->to('igor.ces#sotreq.com');
$Email->subject('About');
$Email->send('My message');
And I get Timeout!!!
Fatal Error
Error: Maximum execution time of 30 seconds exceeded
File: C:\wamp\www\societario\lib\Cake\Network\CakeSocket.php
Line: 190
Any help, please?
Solved.
I tested the application in another network and this work fine. Although the first network having Internet for some reason it's don't work.
Was some kind of network problem.
Thanks