Sent email attachment using mailgun library, codeigniter

268
August 07, 2017, at 4:24 PM

Can anyone please guide me how to send an attachment using mailgun and codeigniter. Searching it from last 3 days and not finding any proper clue that how deal with it. This is my array of data:

$postFields = array(
        "from" => $from,
        "to" => $to,
        "subject" => $subject,
        "html" => $html,
        "text" => $text,
        "o:tag" => $tag,
        "o:dkim" => "yes",
    );

Please help me that how to append an attachment. Tried appending attachment many times while following answers but got failed to receive any of the attachments.

Answer 1

First of all you should insert your Mailgun smtp details into email config file located in config/email.php, then you can send emails through Mailgun. then determine your attachment file using below code:

$this->email->attach('/path/to/file.format');

After set other options mail will send! For more details you can visit: https://www.codeigniter.com/user_guide/libraries/email.html

Rent Charter Buses Company
READ ALSO
How to count number of grandchildren of a model in Laravel 5?

How to count number of grandchildren of a model in Laravel 5?

Let say I have a database like the following:

364
How to get high-res thumbnails out of low-res SVGs in Mediawiki?

How to get high-res thumbnails out of low-res SVGs in Mediawiki?

I don't exactly know how to word this question properly, so I'll make an attempt:

305
Filter specific column in array in php

Filter specific column in array in php

I am trying to filter a specific column in an array in php using the code below:

265
Howto replace hyphen with shy inside paragraph with preg_replace

Howto replace hyphen with shy inside paragraph with preg_replace

How to search and replace hyphens within paragraphs to &shy?

205