Previously, this application has built and been hosted in Amazon by initial authors. Then after, because of some issues with Amazon changed to Godaddy, the problem here is sending email, forgot-password-mails etc and even uploading images are not working when the application is in Godaddy and was working perfectly when its was in Amazon.
I googled some info about AWS & understood that the authors installed the aws-sdk-php 3rd party in vendor folder of my symfony application & used some buckets for storing etc...
So in application I found some variables of AWS in config.yml, config.yml, parameters.yml. Simply I've commented all these variables and changed the code in parameters.yml
from_email_address: xxxxxx@xxx.com
mailer_transport: smtp
mailer_host: email-smtp.us-west-2.amazonaws.com
mailer_user: xxxxxxx
mailer_password: xxxxxxx
locale: en
secret: xxxxxxxxx
debug_toolbar: true
debug_redirects: false
use_assetic_controller: true
amazon_s3.key: xxxxxxx
amazon_s3.secret: xxxxxx
amazon_s3.region: eu-west-1
to
from_email_address: xxxxx@xx.com
# mailer_transport: smtp
# mailer_host: email-smtp.us-west-2.amazonaws.com
# mailer_user: xxxxxxx
# mailer_password: xxxxxxx
mailer_transport: gmail
mailer_host: smtp.gmail.com
mailer_user: xxxxx@xx.com
mailer_password: xxxxxxx
locale: en
secret: xxxxxxx
# debug_toolbar: true
# debug_redirects: false
# use_assetic_controller: true
# amazon_s3.key: xxxxxxx
# amazon_s3.secret: xxxxxxx
# amazon_s3.region: eu-west-1
and also I have changed my code in controller from
$maildata = array(
"name" => $userinfo->getFullname(),
"email" => $userinfo->getEmail(),
"code" => md5($userinfo->getUid())
);
$email = $this->get('emails_handler');
$subject = "Quotemyhouse.com account verification request.";
$message = $this->renderView('AppBundle:Emails:welcomeEmail.html.twig', $maildata);
$email->sendEmail($userinfo->getEmail(), $subject, $message);
to
$maildata = array(
"name" => $userinfo->getFullname(),
"email" => $userinfo->getEmail(),
"code" => md5($userinfo->getUid())
);
$message = $this->renderView('AppBundle:Emails:welcomeEmail.html.twig', $maildata);
$Subject = "Quotemyhouse.com account verification request.";
$msg = \Swift_Message::newInstance()
->setSubject($Subject)
->setFrom($userinfo->getFullname())
->setTo($userinfo->getEmail())
->setBody($message,'text/html');
$this->get('mailer')->send($msg);
the above changed details in config.yml & parameters.yml are working with a sample email sending project in localhost.
So I hope you understood the issue I'm facing... Thanks in advance...