[英]how to send email with attchment file in codeigniter
how to send email with attachment file. 如何发送带有附件文件的电子邮件。 for example I tried attaching the template 例如我尝试附加模板
$arr['email']="Email send successfully";
$this->email->from("Info@.com","example@gmail.com");
$this->email->to(set_value("email"));
$this->email->subject("Registration completed");
$this->email->message("Your Registration Is Completed");
$this->email->send();
echo "<script> alert('Your Registration successfully');</script>";
}
https://www.codeigniter.com/user_guide/libraries/email.html https://www.codeigniter.com/user_guide/libraries/email.html
You can follow official site of codeigniter. 您可以关注codeigniter的官方网站。
Please refer this, https://www.codeigniter.com/user_guide/libraries/email.html 请参考https://www.codeigniter.com/user_guide/libraries/email.html
Kindly follow Emailing section below on same page. 请按照同一页面下面的“发送电子邮件”部分进行操作。
Check Out Codeigniter Official Doc For Sending Attachments With Email. 签出Codeigniter官方文档以通过电子邮件发送附件。 Send Email With Attachments 发送带有附件的电子邮件
Use $this->email->attach('path_to_your_file');
使用$this->email->attach('path_to_your_file');
with your code combination. 与您的代码组合。 It will work. 它会工作。
Enables you to send an attachment. 使您可以发送附件。 Put the file path/name in the first parameter. 将文件路径/名称放在第一个参数中。 For multiple attachments use the method multiple times. 对于多个附件,请多次使用该方法。 For example: 例如:
$this->email->attach('/path/to/photo1.jpg');
$this->email->attach('/path/to/photo2.jpg');
$this->email->attach('/path/to/photo3.jpg');
To use the default disposition (attachment), leave the second parameter blank, otherwise use a custom disposition: 要使用默认配置(附件),请将第二个参数留空,否则请使用自定义配置:
$this->email->attach('img.jpg', 'inline');
You can also use a URL: 您也可以使用以下网址:
$this->email->attach('http://example.com/filename.pdf');
If you'd like to use a custom file name, you can use the third parameter: 如果要使用自定义文件名,则可以使用第三个参数:
$this->email->attach('filename.pdf', 'attachment', 'file.pdf');
If you need to use a buffer string instead of a real - physical - file you can use the first parameter as buffer, the third parameter as file name and the fourth parameter as mime-type: 如果您需要使用缓冲字符串而不是实际文件,则可以将第一个参数用作缓冲区,将第三个参数用作文件名,第四个参数用作mime-type:
$this->email->attach($buffer, 'attachment', 'report.pdf', 'application/pdf');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.