我正在尝试更改' myemail@gmail.com'解决类似的问题:no-reply@gmail.com并尝试添加自定义地址,但我无法让它工作。
我在哪个文件中添加主题和来自?
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=myemail@gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=no-reply@example.com
MAIL_FROM_NAME="Custom App Name"
dispatch(new JblockedUser($user));
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Mail;
use App\User;
use Carbon\Carbon;
use App\Mail\BlockedUser;
class JblockedUser implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $user;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(User $user)
{
$this->user = $user;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$email = new BlockedUser($this->user);
Mail::to('example@gmail.com')->queue($email);
}
}
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class BlockedUser extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->markdown('emails.newsletter');
}
}
答案 0 :(得分:1)
您可以在mailable构建方法中设置subject
和from
。默认情况下,如果未提供Blocked User
地址,则laravel将使用配置文件中设置的全局发件人地址和名称。默认主题将使用您的mailable类名称构建。在您的情况下,public function build()
{
return $this->from('no-reply@example.com')
->subject('Newsletter!!!')
->markdown('emails.newsletter');
}
将成为主题。
public function build()
{
$from = [
'address' => 'no-reply@example.com',
'name' => 'Custom App Name'
];
return $this->from($from)
->subject('Newsletter!!!')
->markdown('emails.newsletter');
}
或者如果您需要指定电子邮件和姓名。
php artisan config:clear
如果您的.env文件更改未反映,您可能希望运行Sub CalculoTotal()
Dim ultima As Long, v As Long, c As Long, ventas(5 To 10) As Long
ultima = Cells(2, Columns.Count).End(xlToLeft).Column
For c = 5 To 10
ventas(c) = 0
Next c
For v = ultima - 2 To 1 Step -1
If Cells(2, v).Value = "VENTA" Then
For c = 5 To 10
ventas(c) = ventas(c) + Cells(c, v + 1).Value
Next c
If Cells(2, v - 1).Value = "TOTAL" Or Cells(2, v - 1).Value = "VACUNA" Then
For c = 5 To 10
Cells(c, ultima).Value = Cells(c, v - 1).Value + ventas(c)
Next c
Exit For
End If
Else
For c = 5 To 10
Cells(c, ultima).Value = Cells(c, v).Value
Next c
Exit For
End If
Next v
End Sub
。