우도비

swift mailer 본문

php

swift mailer

오성민 2014. 12. 29. 10:07

reference url : http://swiftmailer.org/

sample code


// Create the Transport

$transport = Swift_SmtpTransport::newInstance('smtp.cafe24.com', 587, 'tls')

  ->setUsername('아이디')

  ->setPassword('비번');


// Create the Mailer using your created Transport

$mailer = Swift_Mailer::newInstance($transport);


$message = Swift_Message::newInstance();

$message->setSubject('Welcome')

  ->setFrom(array('sm.oh@visualrhyme.com'=>'오성민'))

  ->setTo(array('sm.oh@urbandigital.com'=>'welcome'))

  ->setBody('메일 내용', 'text/html');


// Pass a variable name to the send() method

if (!$mailer->send($message, $failures)) {

  echo "Failures:";

  print_r($failures);

} else {

  echo "success";

}

'php' 카테고리의 다른 글

slim php  (0) 2015.03.13
Comments