1

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...

Prisoner
  • 27,391
  • 11
  • 73
  • 102

2 Answers2

0

I expect all smtp configurations in your GoDaddy account is working. In goDaddy mail functions, hostname you have to keep "localhost". So instead of

mailer_host: email-smtp.us-west-2.amazonaws.com

use mailer_host:localhost

Some cases you don't require to give mailer_user and mailer_password. But that you have to do try and trial.

Subin Thomas
  • 1,408
  • 10
  • 19
  • Hi Thomas, Thanks for your reply... I've changed my code according to your comments and tried with all the trials like giving null to mailer_user, mailer_password & even tried by removing those fields in both parameters.yml & config.yml, but still its not working... – Abhinav Chintakindi Oct 01 '15 at 06:15
  • Presently the entire thing is working perfectly in localhost with my symfony application, but whereas in server its not ! Can I use these gmail details when I'm running in live hosted server? will they work? Are gmail details are only for localhost? – Abhinav Chintakindi Oct 01 '15 at 06:19
  • swift mailer section in **config.yml** : ` # Swiftmailer Configuration swiftmailer: transport: "%mailer_transport%" host: "%mailer_host%" username: "%mailer_user%" password: "%mailer_password%" # encryption: tls spool: { type: memory } #for Gmail encryption: ssl auth_mode: login` – Abhinav Chintakindi Oct 01 '15 at 07:17
  • & in **Parameters.yml** : from_email_address: abhinav@omkieitsolutions.com mailer_transport: gmail mailer_host: localhost mailer_user: testing.trial15@gmail.com mailer_password: Omkietesting locale: en secret: quotemyhouse debug_toolbar: true debug_redirects: false use_assetic_controller: true – Abhinav Chintakindi Oct 01 '15 at 07:20
  • I think PHPmailer is for corePHP projects, but I'm using a framework right, can I use that? then I think I should transfer all corePHP libraries to my symfony project – Abhinav Chintakindi Oct 01 '15 at 07:24
  • I'm using a new gmail ID (which does'nt have security levels) with its password sending to another gmail ID. – Abhinav Chintakindi Oct 01 '15 at 08:50
  • So we completely going on wrong direction. If you want to use gmail for sending email, you had the configuration in your script. I was expecting your own mailhost you are using in GoDaddy. Use the answer of this link. http://stackoverflow.com/questions/19086476/send-mail-through-smtp-gmail-com-in-symfony-2-using-swiftmailer @AbhinavCh – Subin Thomas Oct 01 '15 at 08:58
  • Yes Thomas, according to the changes in answer of above link : working fine in localhost but showing an error when I running in Live Server and the error is : ** Connection could not be established with host smtp.gmail.com [Connection refused #111] 500 Internal Server Error - Swift_TransportException ** – Abhinav Chintakindi Oct 01 '15 at 10:35
  • You login into gmail and allow external connection. https://support.mailpoet.com/knowledgebase/sending-with-gmail-doesnt-work/ this link will do. @AbhinavCh – Subin Thomas Oct 01 '15 at 10:53
  • I think you must have got a mail telling that a unknown access is blocked in your gmail. @AbhinavCh – Subin Thomas Oct 01 '15 at 11:02
  • @AbhinavCh : Try to send mail with normal php code and test your all connections are fine. – Subin Thomas Oct 01 '15 at 11:10
  • Many more thanks for your help Thomas. The problem has been resolved. Actually the Gmail parameters are not working in Live, but when I change the parameters with my project's Godaddy account Email parameters its working... – Abhinav Chintakindi Oct 02 '15 at 05:26
0

Atlast got the solution for the issue... the problem may be with Gmail parameters in live or may be Gmail mailer parameters are only for localhost.. I dont know

Just I've changed the parameters with my Godaddy Account Email paramaeters (which we can find by logging into C-panel of respective account in  Godaddy).

There are two types of details present in that Account/Email page of Godaddy, use the recommended SSL parameters which will be on leftside.

Thank you.