第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

帶有 HTML 聯(lián)系表的 PHPMailer

帶有 HTML 聯(lián)系表的 PHPMailer

PHP
慕碼人8056858 2022-07-22 11:00:09
抱歉我的英語不好 :( 我在這里遇到了一個大問題,我有帶有聯(lián)系表格的 html 主頁。我想用 PHPMailer 發(fā)送這個表格,當(dāng)我發(fā)送消息時我得到這個但沒有文本:/ 我明白了只有像“這里是主題”這樣的示例文本。有人可以幫我嗎?這是 phpmailer.php 代碼:<?phpuse PHPMailer\PHPMailer\PHPMailer;use PHPMailer\PHPMailer\Exception;require 'src/Exception.php';require 'src/PHPMailer.php';require 'src/SMTP.php';$mail = new PHPMailer(true);                              // Passing `true` enables exceptionstry {    //Server settings    $mail->SMTPDebug = 0;                                 // Enable verbose debug output    $mail->isSMTP();                                      // Set mailer to use SMTP    $mail->Host = 'smtp.test.de';  // Specify main and backup SMTP servers    $mail->SMTPAuth = true;                               // Enable SMTP authentication    $mail->Username = 'MY EMAIL';                 // SMTP username    $mail->Password = 'MY PASSWORT!';                           // SMTP password    $mail->SMTPSecure = 'ssl';                           // Enable TLS encryption, `ssl` also accepted    $mail->Port = 465;                                    // TCP port to connect to    //Recipients    $mail->setFrom('MY EMAIL');    $mail->addAddress('MY EMAIL');     // Add a recipient    //Content    $mail->isHTML(true);                                  // Set email format to HTML    $mail->Subject = 'Here is the subject';    $mail->Body    = 'This is the HTML message body <b>in bold!</b>';    $mail->send();    echo 'Message has been sent';} catch (Exception $e) {    echo 'Message could not be sent.';    echo 'Mailer Error: ' . $mail->ErrorInfo;}?>我的電子郵件只是為了安全起見
查看完整描述

1 回答

?
鴻蒙傳說

TA貢獻1865條經(jīng)驗 獲得超7個贊

您需要在 PHPmailer 腳本中添加變量 $_POST :


  <?php

    use PHPMailer\PHPMailer\PHPMailer;

    use PHPMailer\PHPMailer\Exception;


    require 'src/Exception.php';

    require 'src/PHPMailer.php';

    require 'src/SMTP.php';


    $mail = new PHPMailer(true);                              // Passing `true` enables exceptions

    try {

        //Server settings

        $mail->SMTPDebug = 0;                                 // Enable verbose debug output

        $mail->isSMTP();                                      // Set mailer to use SMTP

        $mail->Host = 'smtp.test.de';  // Specify main and backup SMTP servers

        $mail->SMTPAuth = true;                               // Enable SMTP authentication

        $mail->Username = 'MY EMAIL';                 // SMTP username

        $mail->Password = 'MY PASSWORT!';                           // SMTP password

        $mail->SMTPSecure = 'ssl';                           // Enable TLS encryption, `ssl` also accepted

        $mail->Port = 465;                                    // TCP port to connect to


        //Recipients

        $mail->setFrom('MY EMAIL');

        $mail->addAddress($_POST['mail']);     // Add a recipient




        //Content

        $mail->isHTML(true);                                  // Set email format to HTML

        $mail->Subject = $_POST['subject'];

        $mail->Body    = $_POST['text'];


        $mail->send();

        //echo 'Message has been sent';

        header('Location: http://www.example.com/contact.php');

        exit();

    } catch (Exception $e) {

        echo 'Message could not be sent.';

        echo 'Mailer Error: ' . $mail->ErrorInfo;

    }

    ?>


查看完整回答
反對 回復(fù) 2022-07-22
  • 1 回答
  • 0 關(guān)注
  • 91 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號