Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6740755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:38:38+00:00 2026-05-26T11:38:38+00:00

Not sure what is wrong, I made sure to set my headers so perhaps

  • 0

Not sure what is wrong, I made sure to set my headers so perhaps something is wrong. The mailscript that I have is huge so I put together this little tester, when i receive the emails all the html tags are present but no formatting took place. I’m curious if it’s a problem with the way I set up the header or if I needed more to it. I searched the forums and it looked like the problem most people had was they weren’t adding in the HTML content-type but that is added in here, so any help would be awesome.

thanks

Okay so I’ve checked out some tutorials online
http://www.webhostingtalk.com/showthread.php?t=416467
http://css-tricks.com/2866-sending-nice-html-email-with-php
http://www.w3schools.com/php/func_mail_mail.asp

<?php
session_start();
if (isset($_SESSION['new_count'])) //counts how many fake emails i send myself
{
    $count = $_SESSION['new_count'];
}
else
{
    //first time
    $count = 0;
}

$to = 'myemail@gmail.com';
$subject = 'email test';
$message = '<html><head></head><body>';
$message .= '<h1>this is an email test</h1>';
$message .= '<br />does new line work?<br />';
$message .= 'how about <b>bold</b> and <strong>strong</strong>?<br />';
$message .= '</body></html>';
//updated my header to include mime-version
$mailheader = 'MIME-Version: 1.0' . '\r\n';
$mailheader .= 'Content-type: text/html; charset=ISO-8859-1' . '\r\n';
$mailheader .= 'from: abc@def.com <btyazaki@gmail.com>' . '\r\n';

$yay = mail($to,$subject,$message,$mailheader);

if($yay)
{
    echo 'woot';
    $count++;
    $_SESSION['new_count'] = $count;
    echo '<br>Emails Sent: '.$count;
}
else
{
    echo 'no woot';
}
?>

I updated the headers to the suggested forms on W3 and a few other places. I’m guessing that my headers are the problem… this still outputs regular text not html not sure what the problem is. As for the structure of this script it’s not my actual mailer script it’s a test script w/ a counter so I know how many emails to look out for during a test session.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:38:39+00:00Added an answer on May 26, 2026 at 11:38 am

    Try using double quotes for your \r\n.

    $mailheader = 'MIME-Version: 1.0' . "\r\n";
    $mailheader .= 'Content-type: text/html; charset=ISO-8859-1' . "\r\n";
    $mailheader .= 'from: abc@def.com <btyazaki@gmail.com>' . "\r\n";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure what's wrong with the following setup. I have a View that
I'm not sure what I'm doing wrong here... I have a custom HashTable that
I got this error message and I'm not quite sure whats wrong: Exception in
Not sure if this is intended behavior or a bug or a wrong function
I am not sure what I could be doing wrong that causes info level
I know this probably really simple but Im not sure what im doing wrong...
I'm mot sure if I'm doing this wrong or not I don't know if
Not sure what I'm doing wrong with .live() $(function(){ var wrapper = $('#trailer_wrapper'); var
I am not sure what I am doing wrong, It would be great if
I'm not sure what I am doing wrong, but the text for my JPanels

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.