Viewed   217 times

I am trying to send email from my php :

$to = '';
    $email_from = "";

    $full_name = 'Suraj Hazarika';
    $from_mail = $full_name.'<'.$email_from.'>';

    $subject = "testing sender name";
    $message = "";
    $message .= '
            <p><strong>This is only a test . Please do not reply.</strong><br />
    $from = $from_mail;

    $headers = "" .
               "Reply-To:" . $from . "rn" .
               "X-Mailer: PHP/" . phpversion();
    $headers .= 'MIME-Version: 1.0' . "rn";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";        

I am following the tutorial PHP E-mail Form Sender Name Instead Of E-mail? but I am still getting the emails with sender name with hostname.

     From                              Date             Subject  Fri, 11:24 pm       testing sender name  Fri, 11:24 pm       testing sender name



You only use $from in your Reply-To header. If you want it to be in the From header, you need to set it in the From header.

Put something like this before your mail() command:

$headers .= 'From: ' . $from . "rn";
Tuesday, September 13, 2022
    $page_content = "./include/signup_content.php";
    $page_header = "./include/signup_header.php";


    <?php include $page_header; ?>

<body id="home">
    <div class = "container">
       <?php include $page_content; ?>

that's all

I hope that signup_content.php contains the similar template only

Thursday, September 29, 2022

Please please please don't build your own MIME emails. Use PHPMailer or Swiftmailer, which do almost everything for you. You can replace you entire script with about 5 or 6 lines of code.

And best of all, they'll give you far better error messages/diagnostics than the pathetically stupid mail() function ever will.

Tuesday, December 27, 2022

I compared what are the differences in the header between a "first" email and a reply.

To make a reply, it seems you've to add two lines in the reply header :

  • In-Reply-To: [Message-ID] (with Message-ID found in the header of the first mail)

  • References: [Message-ID]

Obviously, you have to change the from and to in the reply email. (I think SwiftMailer creates others by itself)

To add line in email header using SwiftMailer, proceed like that :

$headers = $message->getHeaders();

$headers->addTextHeader('In-Reply-To', $previousEmail->getHeaders()->getMessageId());

This getter I put is just how I imagine your email entity.

For the forward, juste print the source of an email and check differences.

Hope it could help.

Update :

For a forward : it is exactly the same thing. I just compared the two headers.

You've to add In-Reply-To and References.

And to answer your update : You can put anything you want (string obviously) in an email header. The spam score will not grow up if you add an unknown variable in it.

Monday, October 10, 2022



instead of

echo $row;

and if you just want to see the values of the array you can do something like the following

for ($var = 0; $var < sizeof($row); $var++) echo $row[$var].", ";
Sunday, August 21, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :