Dream weaving custom form to send email super simple version (support QQ mailbox 163 mailbox)

1, QQ mailbox or 163 mailbox to open the SMTP service, get the authorization code, according to your own

QQ mailbox opens SMTP service
write picture description here
163 mailbox opens SMTP service
write picture description here
126 mailbox opens SMTP service, the same as 163.

2. Website background - system - system basic parameters - core settings

Website sending EMAIL: [email protected]or [email protected]
Whether to enable SMTP to send mail:
SMTP server: ssl://smtp.163.comor ssl://smtp.qq.com
SMTP server port: 465
SMTP server user mailbox: [email protected]or [email protected]
SMTP server user account: dedehtmlor 858265175
SMTP server user password: 填你邮箱授权码,不是邮箱登录密码
configure 163 mailbox is like this
write picture description here
Configure QQ mailbox This is the way to
write picture description here
configure 126 mailboxes like this
write picture description here

3. Website background - system - system basic parameters - add new variables

Variable Name: cfg_shoujianren
Variable Type: 文本
Parameter Description: 收件人
Variable Value: [email protected]
Group: As shown in the 站点设置
figure
write picture description here

4. Open /plus/diy.php and find

$id = $dsql->GetLastID();

add below it

$mailtitle = "{$diy->name}--留言通知";
$mailbody = '';
foreach($diy->getFieldList() as $field=>$fieldvalue)
{
    $mailbody .= "{$fieldvalue[0]}:{${$field}}\r\n";
}
$headers = "From: ".$cfg_adminemail."\r\nReply-To: ".$cfg_adminemail;
if($cfg_sendmail_bysmtp == 'Y' && !empty($cfg_smtp_server))
{
    $mailtype = 'TXT';
    require_once(DEDEINC.'/mail.class.php');
    $smtp = new smtp($cfg_smtp_server,$cfg_smtp_port,true,$cfg_smtp_usermail,$cfg_smtp_password);
    $smtp->debug = false;
    $smtp->sendmail($cfg_shoujianren,$cfg_webname ,$cfg_smtp_usermail, $mailtitle, $mailbody, $mailtype);
}
else
{
    @mail($cfg_shoujianren, $mailtitle, $mailbody, $headers);
}

At this point, the custom form sends an email to notify the administrator that it is completed

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325597028&siteId=291194637