Source Code for Me (s-c.me)

Allows you to paste souce code to blogs! Adapted for Twitter! Here is Search Form in case you missed your code.
Tags: Php,$transport,$mailer,$message,$body,$attach, Created At: 3/14/2018 7:02:31 AMViews:

HTML view:
Copy Source | Copy HTML
  1. $transport = Swift_SmtpTransport::newInstance();
  2. $transport->setUsername('login');
  3. $transport->setPassword('password');
  4. example.com/image.jpg
  5. $mailer = Swift_Mailer::newInstance($transport);
  6. $message = Swift_Message::newInstance();
  7. $message->setSubject('Hello man!');
  8. $message->setFrom(array('r2d2@example.com'=>'R2D2'));
  9. $message->setTo('c3po@example.com', 'C3PO');
  10. $body='<img src="http://example.com/image.jpg">';
  11. $message->setBody($body, 'text/html');
  12. $attach=Swift_Attachment::fromPath('/home/example/htdocs/image.jpg');
  13. // Ðº Ð¾Ð±Ñ‹Ñ‡Ð½Ð¾Ð¼Ñƒ Ð°Ñ‚тачу Ð´Ð¾Ð±Ð°Ð²Ð»ÑÐµÐ¼ Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²Ð¾Ðº Content-Location
  14. $attach->getHeaders()->addTextHeader('Content-Location', 'http://example.com/image.jpg');
  15. $message->attach($attach);
  16. $mailer->send($message);

Based on Manoli.Net's CodeFormatter. Made by Topbot (c) 2008-2018