我希望在使用laravel发送电子邮件时,此消息显示在roundcube的已发送电子邮件框中。我知道Laravel使用SMTP,但这种方式不起作用。我需要一些方法来做。我发现了可能的solution,但我不知道如何将其应用于代码。
我使用Laravel 5.2,并发送如下电子邮件:
$config = array(
'driver' => 'smtp',
'host' => 'smtp.example.es',
'port' => '25',
'from' => array('address' => 'email@example.es', 'name' => 'BILL'),
'encryption' => '',
'username' => 'email@example.es',
'password' => '123456',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false
);
Config::set('mail',$config);
Mail::send('emails.bill', array(
'name' => $customer->name, 'lastname' => $customer->lastname,
'concept' => $bill->concept ), function($message) use ($data)
{
$message->setEncoder(Swift_Encoding::get8BitEncoding());
$message->to($data['email'])->subject('BILL - '.$data['concept']);
$message->attach($data['doc']);
});
答案 0 :(得分:0)
这可以为您服务:)
//INI PARA GUARDR EN LA CARPETA DE ENVIADOS
/* First, retrieve a raw copy of the message */
$msg_raw = "body raw";
/* Open an IMAP connection to your server, use config, env... whatever */
$stream = imap_open(
"{".config('mail.host')."/imap/ssl/novalidate-cert}",
config('mail.username'),
config('mail.password'),
null,
1,
['DISABLE_AUTHENTICATOR' => 'GSSAPI']
);
/* Store the email as Seen (or not) into your sent folder, use config, env... whatever */
imap_append(
$stream,
"{".config('mail.host')."/imap/ssl/novalidate-cert}" . config('mail.imap_sent'),
$msg_raw."\r\n",
"\\Seen" /* just empty if you prefer Unseen */
);
/* Close the stream, cleanup */
imap_close($stream);
//FIN PARA GUARDR EN LA CARPETA DE ENVIADOS