framework is integrated with the mailbox class, you can see in the common/config/main-local.php file:
'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', 'viewPath' => '@common/mail',],
This is the related configuration file, which is put into the *-local file because it contains sensitive information of the personal account.
The configuration information above is incomplete. you need to fill in the
, which can be seen in the common/config/main-local.php file:
' Mailer ' = [ ' class ' = ' Yii\swiftmailer\mailer ', ' viewPath ' = ' @common/mail ',] ,
This is the relevant configuration file, which is put into the *-local file because it contains sensitive information about your personal account.
The above configuration information is not complete, need to fill out the sender mailbox, port number an
.
After the operation is successful, a sendreminderemail.php is generated in the App/jobs directory, and we modify the contents as follows:
namespace App\jobs;
Use App\jobs\job;Use Illuminate\queue\serializesmodels;Use Illuminate\queue\interactswithqueue;Use illuminate\contracts\bus\selfhandling;Use Illuminate\contracts\queue\shouldqueue;Use App\user;Use Illuminate\contracts\mail\mailer;Class Sendreminderemail extends Job implements Selfhandling, S
. configure the mailbox by the way. When you complete the first three steps, you can register a member. if you forget your password, click Forgot password on the logon page. you need to retrieve the password by email. Therefore, you need to configure the mailbox:
Yii2 pro framework is integrated with the mailbox class, you can see in the common/config/main-local.php file:
'mailer' => [ 'class' => 'yii\swiftmailer\
:$container->set (' yii\mail\mailinterface ', ' Yii\swiftmailer\mailer ');This means that if a dependent mailinterface is encountered, then constructs a Mailer object to it, the params is used to pass to the mailer::__construct the construction parameter, previously mentioned the dependency analysis is recursive, The construction of the Mailter object is also di
{Code ...} after the code is generated, {code...} In AppJobs ...} this is used in the Controller; {code ...} here, send an email to the handle method. The $ email variable cannot be obtained in the handle method. How does the job queue handle the variable "$ email"? How does one input more data? In the controller, input the result...
php artisan make:job SendEmail --queued
After being generated
User = $ user;}/*** Execute the job. ** @ return void */public function handle (
user comment out the sections below, or you'll never be able to log in:
‘user‘ => [ ‘identityClass‘ => ‘app\models\User‘, ‘enableAutoLogin‘ => true, ],*/The last step is to execute the Yii2-user migration , which is helloYii/ executed under the directory:php yii migrate/up --migrationPath=@vendor/dektrium/yii2-user/migrationsThen you will see:DecisiveyesBang, here Yii2-user installation and configuration has been completed.Configure SwiftmailerAfter installing Yii2-us
PHP Email: swiftmailer, PHP Mail library--swiftmailerRecently saw a good PHP mail library, like Phpmailer role, but performance than Phpmailer, especially in the ability to handle attachments, send mail success is also high.GitHub Address: Https://github.com/swiftmailer/swiftmailer.gitRequire_once ("lib/swift_required.php");//Create transport object, set mail server and port number, and set user name and password for authentication $transport = Swift_smtptransport :: Newinstance (' smtp.163.com
FEATURE (redirect) dnl
FEATURE (always_add_domain) dnl
FEATURE (use_cw_file) dnl
FEATURE (use_ct_file) dnl
Dnl The '-t' option will retry delivery if e.g. the user runs over his quota.
FEATURE (local_procmail, '', 'procmail-t-Y-a $ h-d $ U') dnl
FEATURE ('Access _ db', 'hash-T
;-O/etc/mail/access. db') dnl
FEATURE ('blacklist _ recipients ') dnl
EXPOSED_USER ('root') dnl
Dnl This changes sendmail to only listen on the loopback device 127.0.0.1
Dnl and not on any other network devices. Co
It would be very easy to set up a controller as a SOAP service with some tools. First, you must have a PHP SOAP extension installed. Since PHP SOAP extensions cannot generate WSDL now, you can either create your own from scratch and use a third-party builder.There are some SOAP service interfaces that you can use in PHP. Zend SOAP and Nusoap are two of them. Although PHP SOAP extensions are used in these examples, common ideas can be used in other application interfaces.Soap works by exposing a
Yii2 sends email, yii2 sends email
Official documents: http://www.yiiframework.com/doc-2.0/guide-tutorial-mailing.html
When using the Yii2 framework, sometimes you need to send an email. Yiii2 provides the swiftMailer extension;
1. swiftMailer
Swift is a PHP function library that uses fully object-oriented encoding for sending e-mail. Swift does not rely on the mail () function of PHP, because it occupies high server resources when sending multiple emails. Swift can send emails faster and more e
Check my configuration item {code...} And then upload my sending code {code...}. How can I test it? Is my posture incorrect ?! First go to my
Configuration item
'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', 'viewPath' => '@common/mail', 'useFileTransport' => true, 'transport' => [ 'class' => 'Swift_SmtpTransport', 'host' => 'smtp.163.com', '
This is the code: ActivationService. php {code ...} error message: {code ...} the position of the 53 lines is annotated in the code. the code is $ user- amp; gt; activatedtrue; problem: how can the above code solve this error? This is the code:
ActivationService. php
Mailer = $ mailer; $ this-> activationRepo = $ activationRepo;} public function sendActivationMail ($ user) {if ($ user-> activated |!
When it comes to testing the mail-sending program, we first want the system to send mail. Let's first add the ability to send mail to the system.
Action Mailer in Rails 3 is a good video tutorial that you can refer to.
There is a more detailed introduction of http://guides.rubyonrails.org/action_mailer_basics.html.
Add Mail Send Program
Send mail to ensure that we have the target mailbox, so our users have a property: email.
Or take my blog proje
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.