Welcome Guest, Not a member yet? Register   Sign In
Uploading Multiple Files As Email Attachment
#21

[eluser]RaGe10940[/eluser]
So then... this worked :

Code:
$file = $return[0]["full_path"];
   $file1 = $return[1]["full_path"];

Code:
$this->email->attach($file);
   $this->email->attach($file1);

got both attachments... now i need to do a foreach loop... but would I need to do 1 or 2 loops?

I need to do the loop over the attachments (i think)

#22

[eluser]TheFuzzy0ne[/eluser]
If you know you're only going to have two file attachments, then you can hard- code it in, but if you want to make your code more robust (which is not a bad thing), you can loop through the attachments and attach them one at a time. The attachments should be the only thing you need to loop over if you're only sending a single email. Everything else should be outside of the loop.

Code:
foreach ($return as &$file)
{
    $this->email->attach($file['full_path']);
}

// ...

if ($this->email->send())
{
    // Hooray! (Sorry, I get excited easily!)
}
else
{
    // Aww... :( (Sorry, I am also easily disappointed...)
}
#23

[eluser]RaGe10940[/eluser]
Your freaking awesome man
#24

[eluser]TheFuzzy0ne[/eluser]
Well, I always wondered... But now I know -- Thanks! Wink




Theme © iAndrew 2016 - Forum software by © MyBB