I have created a web application as such in the application I require to send to send users their passwords if they have forgotten them. Now I use a gmail account to send the email. When I send the email locally from my machine using XAMPP everything works fine and it delivers as expected. When I look to put the php script onto a Hostgator server and try send the user their password I can't. But the reason I think this is happening is because Gmail immediately send me the following:
Someone recently used your password to try to sign in to your Google Account [email protected]. This person was using an application such as an email client or mobile device.
We prevented the sign-in attempt in case this was a hijacker trying to access your account. Please review the details of the sign-in attempt:
Tuesday, January 21, 2014 1:42:56 PM UTC
IP Address: 198.57.247.245 (gator3281.hostgator.com.)
Location: Los Angeles, CA, USA
If you do not recognize this sign-in attempt, someone else might be trying to access your account. You should sign in to your account and reset your password immediately
Based on this email I would assume that Gmail is touchy that hostgator is trying to send an email via them. My problem is I don't know how to fix this problem (This is my first time doing something like this) As such I was using a PHP framework called codeigniter and here is the code used to send the email (Note this code works more than fine locally i.e. I dont think there is anything wrong with the code):
public function SendEmailValidate($email,$subject,$message,$type)
{
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'mypassword',
'smtp_timeout' => 30,
'mailtype' => $type
);
$CI = &get_instance();
$CI->load->library('email',$config);
$CI->email->set_newline("\r\n");
$CI->email->from('[email protected]','Book Bay');
$CI->email->to($email);
$CI->email->subject($subject);
$CI->email->message($message);
if($CI->email->send())
{
return true;
}
else
{
return false;
}
}
Any help on this matter would really help, thanks
its in your gmail settings; you need to allow your website to send emails;
to do so go to https://accounts.google.com/DisplayUnlockCaptcha and click continue; then useyour website to send email an email; and google will detect your login attempt and allow you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With