Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Create the message
- $message = Swift_Message::newInstance('My subject');
- // Set the body
- $message->setBody(
- '<html>' .
- ' <head></head>' .
- ' <body>' .
- ' Here is an image <img src="' . // Embed the file
- $message->embed(Swift_Image::fromPath('image.png')) .
- '" alt="Image" />' .
- ' Rest of message' .
- ' </body>' .
- '</html>',
- 'text/html' // Mark the content-type as HTML
- );
- // You can embed files from a URL if allow_url_fopen is on in php.ini
- $message->setBody(
- '<html>' .
- ' <head></head>' .
- ' <body>' .
- ' Here is an image <img src="' .
- $message->embed(Swift_Image::fromPath('http://site.tld/logo.png')) .
- '" alt="Image" />' .
- ' Rest of message' .
- ' </body>' .
- '</html>',
- 'text/html'
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement