简体   繁体   English

我的项目中由Symfony2 Framework制作的“电子邮件功能”出现问题

[英]Issue with “Email Feature” in my project which is made with Symfony2 Framework

Previously, this application has built and been hosted in Amazon by initial authors. 以前,此应用程序是由最初的作者构建并托管在Amazon中的。 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. 然后,由于Amazon更改为Godaddy的某些问题,这里的问题是发送电子邮件,忘记密码邮件等,甚至当应用程序位于Godaddy时上传的图像也无法正常工作,而当应用程序位于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... 我在Google上搜索了一些有关AWS的信息,并了解到作者在我的symfony应用程序的vendor文件夹中安装了aws-sdk-php 3rd party并使用了一些存储桶等。

So in application I found some variables of AWS in config.yml, config.yml, parameters.yml. 因此,在应用程序中,我在config.yml,config.yml,parameters.yml中找到了一些AWS变量。 Simply I've commented all these variables and changed the code in parameters.yml 简而言之,我已经注释了所有这些变量并更改了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. config.ymlparameters.yml中的上述更改的详细信息正在本地主机中的示例电子邮件发送项目中工作。

So I hope you understood the issue I'm facing... Thanks in advance... 因此,我希望您能理解我面临的问题...预先感谢...

I expect all smtp configurations in your GoDaddy account is working. 我希望您GoDaddy帐户中的所有smtp配置都能正常工作。 In goDaddy mail functions, hostname you have to keep "localhost". 在goDaddy邮件功能中,主机名必须保留“ localhost”。 So instead of 所以代替

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

use mailer_host:localhost 使用mailer_host:localhost

Some cases you don't require to give mailer_user and mailer_password . 在某些情况下,您不需要提供mailer_usermailer_password But that you have to do try and trial. 但是,您必须尝试一下。

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 Atlast得到了该问题的解决方案...问题可能是实时存在Gmail参数,或者Gmail邮件程序参数仅适用于本地主机。.我不知道

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. Godaddy的“帐户/电子邮件”页面中存在两种类型的详细信息,请使用建议的SSL参数,该参数位于左侧。

Thank you. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM