I have a Swiftmailer PHP script that is running as below.
At the minute it's echoing the image path but I'd like to pull through the image within the email itself.
I have managed to get a separate version working where I include the attachment from Path of a live URL working but can't seem to work out how to get it to pull through the $media version instead.
Any help would be gratefully appreciated. Thanks.
message = \Swift_Message::newInstance();
$message->attach(\Swift_Attachment::fromPath('https://www.google.co.uk/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png'))
->setSubject('Form')
->setFrom('test@test.com', 'Test')
->setTo('test@test.com', 'Test Name')
->setContentType("text/html")
->setBody(
$this->renderView(
'Contact:Contact:contact.html.twig',
array(
'ip' => $request->getClientIp(),
'name' => $form->get('name')->getData(),
'email' => $form->get('email')->getData(),
'media' => $form->get('media')->getData()
)
)
);
# Send message
$this->get('mailer')
->send($message);