How to send emails connecting to the SMTP server directly?

后端 未结 3 1188

I do not want to use mail() to send e-mail. I would like to connect to the SMTP server directly.

Is there a class to do this job?

相关标签:
3条回答
  • 2021-01-21 04:51

    Zend_Mail can do this for you:

    $tr = new Zend_Mail_Transport_Smtp('mail.example.com');
    Zend_Mail::setDefaultTransport($tr);
    
    $mail = new Zend_Mail();
    $mail->addTo('studio@example.com', 'Test');
    $mail->setFrom('studio@example.com', 'Test');
    $mail->setSubject('Subject');
    $mail->setBodyText('...Your message here...');
    $mail->send();
    
    0 讨论(0)
  • 2021-01-21 04:55

    You have a list of existing smtp classes here

    0 讨论(0)
  • 2021-01-21 05:03

    SwiftMailer does this.

    http://swiftmailer.org/

    0 讨论(0)
提交回复
热议问题