Jump to content

Recommended Posts

if ($_POST['send'] == 'Lähetä') {
	
    if ($_SESSION['tarjouskori']) { // Estetään tuplasähköpostit.
        $message = "Lähettäjä: $_POST[billto_first_name]\n<br>";
        $message.= "Puhelin: $_POST[billto_phone_number]\n<br>";
        $message.= "Sähköposti: $_POST[billto_email]\n<br>";
        $message.= "Lisätoiveet: $_POST[special_requests]\n\n<br>";
        $message.= "Tuotteet\n<br><br>";
        
       // Always set content-type when sending HTML email
		$headers = "MIME-Version: 1.0" . "\r\n";		
		$headers = "Content-type: text/html; charset=iso-8859-1;" . "\r\n";
		
		echo "<html><head><title></title></head><body>";
        foreach ($_SESSION['tarjouskori'] as $product) {
            $message.= $product[product_code] . ' | ' . $product[product_name] . ' | ' . "<a href=\"http://www.mydomain.fi/" . "product_details.php?p=". $product[product_id] . "\">" . "Linkki</a><br>\n";
        }
        $message.= "\n";
		echo "</body></html>";
		
        
        $receiver = "$config[cs_setting_shop_email]";        
        $topic = "-Tarjouspyyntö- " .  substr($_POST[billto_email], 0, strpos($_POST[billto_email], '@', 2));
		$headers.= "From: $_POST[billto_first_name] <$_POST[billto_email]>\r\n";
		
        if (!$config['demo_mode']) @mail ($receiver, $topic, $message, $headers);    
        unset($_SESSION['tarjouskori']);
    }
    $thanks = true;
}

I need to format email to html. But I cannot figure out what is wrong with this. When I test this with name: FirstName LastName I get email where first row is: From: FirstName "LastName" Lähettäjä: FirstName LastName. I don't need that from there. If I take code $headers.= "From: $_POST[billto_first_name] <$_POST[billto_email]>\r\n"; away, then that from line goes away. But how I can get senders name and email address. Topic works but sender is empty.

Link to comment
https://forums.phpfreaks.com/topic/295643-email-with-html-tags/
Share on other sites

    if ($_SESSION['tarjouskori']) { // Estetään tuplasähköpostit.
        $message = "Lähettäjä: ".$_POST[billto_first_name]."\n<br>";
        $message.= "Puhelin: ".$_POST[billto_phone_number]."\n<br>";
        $message.= "Sähköposti: ".$_POST[billto_email]."\n<br>";
        $message.= "Lisätoiveet: ".$_POST[special_requests]."\n\n<br>";
        $message.= "Tuotteet\n<br><br>";

".$_POST['billto_first_name']."

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.