代码之家  ›  专栏  ›  技术社区  ›  Yousef Altaf

更改我的电子邮件标题

php
  •  0
  • Yousef Altaf  · 技术社区  · 15 年前

    当发送邮件时,邮件头会像这样出现在我的面前(quigon.myinternetwebhost.com),然后我的邮件的主题是如何将它(quigon.myinternetwebhost.com)更改为我的公司名称(任何名称),这是我的代码。

    <?php 
    
        include_once ("../admin_config/config.php");
    
        error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
    
        $getMails = "select * from maling_list";
        $result = $db -> query ($getMails) or die ($db->error);
    
        $dbfailures = array();
        $failures = array();
        $success = array();
    
    
            $subject = filter_input (INPUT_POST, 'subject');
            $cat = filter_input (INPUT_POST, 'category');
            $mailbody = filter_input (INPUT_POST, 'body');
    
            $mailMessage = "Category : $cat\r\n$mailbody" ;
            $headers = "From : add@egindex.com"; 
            $headers .= "From : add@egindex.com";
    
    
        while($row = $result -> fetch_array()) {
    
    
            $email = $row['email'];
            $name = $row['company'];
    
    
        $mailResult = mail($email, $subject, $mailMessage, $headers, '-f add@egindex.com');
    
    
    
            if ($mailResult) {
    
                $success[] = $email;
    
                }else{
    
                    $dbfailures[] = $email;
                    echo "<br />";
                    $failures[] = $email;
    
                    }
                }
    
              echo "<font color='#FF0000'><b>These mails didn't get sent:</b></font> ".htmlentities(implode(', ', $failures))."<br />".
                    "<font color='#009900'><b>These mails were successfully sent:</b></font> ".htmlentities(implode(', ', $success));
    
    
    
    ?>
    
    <br /><br /><br />
    <input name="Submit" type="submit" value="Back" style="position:absolute; right:200px;" onclick="history.back()" />
    <br /><br /><br /> 
    

    这里有人请帮帮我!!

    1 回复  |  直到 15 年前
        1
  •  1
  •   user455982    14 年前

     $headers = "MIME-Version: 1.0" . "\r\n";
     $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
     $headers .= "From : add@egindex.com"; 
     $subject = filter_input (INPUT_POST, 'subject');
    

    推荐文章