Created
May 2, 2011 10:37
-
-
Save dragoonis/951422 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Do we have attachments ? | |
if($attachment !== null) { | |
// If its a singular string based attachment we convert it to conform with the generic attachment structure | |
if(!is_array($attachment)) { | |
$attachment = (array) $attachment; | |
} | |
// Attach all of our attachments | |
foreach($attachment as $att) { | |
// If its an array and we have 'title', 'path' then we can add the attachment and rename it. | |
if(is_array($att) && isset($att['title'], $att['path'])) { | |
$message->attach( | |
Swift_Attachment::fromPath($att['path'])->setFilename($att['title']) | |
); | |
// Standard attach | |
} else { | |
$message->attach(Swift_Attachment::fromPath($att)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment