[英]Sent email attachment using mailgun library, codeigniter
誰能指導我如何使用mailgun和codeigniter發送附件。 最近3天對其進行搜索,但沒有找到任何適當的線索來對其進行處理。 這是我的數據數組:
$postFields = array(
"from" => $from,
"to" => $to,
"subject" => $subject,
"html" => $html,
"text" => $text,
"o:tag" => $tag,
"o:dkim" => "yes",
);
請幫助我,如何附加附件。 在遵循答案時嘗試了多次附加附件,但未能收到任何附件。
首先,您應該將Mailgun smtp詳細信息插入位於config / email.php的電子郵件配置文件中,然后才能通過Mailgun發送電子郵件。 然后使用以下代碼確定您的附件文件:
$this->email->attach('/path/to/file.format');
設置其他選項后,郵件將發送! 有關更多詳細信息,您可以訪問: https : //www.codeigniter.com/user_guide/libraries/email.html
如果config文件夾中沒有任何email.php文件,只需創建它,然后將以下代碼粘貼並編輯到其中即可:
<?php
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.mailgun.org';
$config['smtp_port'] = 465;
$config['smtp_user'] = '';
$config['smtp_pass'] = '';
$config['smtp_timeout'] = '4';
$config['crlf'] = '\n';
$config['newline'] = '\r\n';
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
?>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.