PHP code example of gclinux / smtper

1. Go to this page and download the library: Download gclinux/smtper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gclinux / smtper example snippets


$mail = new gclinux\Smtper();

 $mail->setDebug(true); //do you want to output the debug information.是否输出调试信息

 $mail->setServer("smtp.XXX.COM", "your_acount@XXXXX", "passwd"); //Setting the SMTP server without SSL. 无SSL的SMTP服务器设置

$mail->setServer("XXXXX", "joffe@XXXXX", "XXXXX", 465, true); //Seeting the SMTP server with SSL .SSL的SMTP服务器设置

 $mail->setFrom("XXXXX"); //Email Sender name 发送者

 $mail->setReceiver("XXXXX@local"); //Email reciver 接收者
 $mail->setReceiver("XXXXX2@local"); //Email reciver,multiple calls will add recivers.多次调用会累计添加接受者
 
 $mail->setCc("XXXX"); //Set CC .抄送
$mail->setBcc("XXXXX"); //Set CC,multiple calls will append.多次调用会添加.

 $mail->addAttachment("XXXX.png"); //Attachment 附件

 $mail->addAttachment("XXXX.csv"); // 添加附件,多个附件,调用多次 

 $mail->setMail("title ", "<b>body</b>"); //the titile and body 标题和内容

$mail->send();