<?php $su = 'register'; $ge = '1362836763@qq.com'; $co = 'Please register!'; send_mail($su,$ge,$co); function send_mail($subject,$getter,$content) { $https['ssl']['verify_peer'] = FALSE; $https['ssl']['verify_peer_name'] = FALSE; $result = false; $sender = 'yourEmailName@163.com'; $transport = Swift_SmtpTransport::newInstance('smtp.163.com', 465,'ssl') ->setUsername($sender) ->setPassword('yourEmailPassword') ->setStreamOptions($https); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance($subject) ->setFrom(array($sender => 'Chinese Project')) ->setTo($getter) ->setBody($content) ; $result = $mailer->send($message); $success = $result ? 0 : 1; return $result; }