迅捷库无法发送消息

时间:2019-01-05 05:56:20

标签: codeigniter

我正在使用swiftlibrary,但是我无法发送消息,请为此提供帮助

require_once(APPPATH.'libraries / swiftmailer / lib / swift_required.php');

    $transport = Swift_MailTransport::newInstance();
    $message = Swift_Message::newInstance();


    $message->setSubject('Your subject')
    ->setFrom('abc@gmail.com')
    ->setTo('xyz@gmail.com')
    ->setBody('Here is the message sent with swiftmailer')
    ->addPart('<q>Here is the message sent with swiftmailer</q>', 'text/html');


    $mailer = Swift_Mailer::newInstance($transport);
    $result = $mailer->send($message);

    if($result)
    {
        echo "Email sent successfully";
    }
    else
    {
        echo "Email failed to send";
    }

0 个答案:

没有答案