Skip to content

Instantly share code, notes, and snippets.

@ederrafo
Last active November 30, 2016 19:28
Show Gist options
  • Save ederrafo/ea56ce3d7b6c1df15bd1a45b32dbbb6a to your computer and use it in GitHub Desktop.
Save ederrafo/ea56ce3d7b6c1df15bd1a45b32dbbb6a to your computer and use it in GitHub Desktop.
<?php
/**
SF 2.8
*/
$fileTmpPath = $_FILES['job_send_your_resume']['tmp_name']['file'];
$fileTmpName = $_FILES['job_send_your_resume']['name']['file'];
$transport = \Swift_SmtpTransport::newInstance('smtp.gmail.com', 587,'tls')
->setUsername('***@*****.**')
->setPassword('********1');
$mailer = \Swift_Mailer::newInstance($transport);
$message = \Swift_Message::newInstance('Correo mail de prueba')
->setFrom('[email protected]')
->setTo('[email protected]')
->setBody("fdshafdsf sdfsa envado ", 'text/html')
->setCharset('UTF-8');
$message->attach(
\Swift_Attachment::fromPath($fileTmpPath)->setFilename($fileTmpName)
);
$res = $mailer->send($message);
var_dump($res);
/*Sample 2*/
$message = \Swift_Message::newInstance()
->setSubject('Some Subject')
->setFrom('[email protected]')
->setTo('[email protected]')
->setBody('ExampleBundle:Default:mail.html.twig', 'text/html');
# Send the message
$response = $this->get('mailer')->send($message);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment