Yousef Altaf
Yousef Altaf

Reputation: 2763

change my email header

When sending my mail the header come to me like this (quigon.myinternetwebhost.com) and then the subject of my mail how do I change this (quigon.myinternetwebhost.com) to my company name (any name) This is my code

<?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 : [email protected]"; 
        $headers .= "From : [email protected]";


    while($row = $result -> fetch_array()) {


        $email = $row['email'];
        $name = $row['company'];


    $mailResult = mail($email, $subject, $mailMessage, $headers, '-f [email protected]');



        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 /> 

Any Body here please help me!!

Upvotes: 0

Views: 180

Answers (1)

user455982
user455982

Reputation:

User this code. This may help you.

 $headers = "MIME-Version: 1.0" . "\r\n";
 $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
 $headers .= "From : [email protected]"; 
 $subject = filter_input (INPUT_POST, 'subject');

Thanks,

Kanji

Upvotes: 1

Related Questions