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 85823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:08:59+00:00 2026-05-10T22:08:59+00:00

The code below is the code i am using. It works fine in thunderbird

  • 0

The code below is the code i am using. It works fine in thunderbird but not in mac mail client (and i assume anything made by microsoft. I currently do not have access to this to test it in). Much as i am aware of the idiosyncrasies of the various mail clients, I am flummoxed by this! It’s fairly self explanatory but i am trying to send plain text and html emails to increase the readership. Any help would be much appreciated.

EDIT

I should have clarified that the contents get sent regardless but in thunderbird it displays the message correctly, but in mac mail client you get the entire thing from the first PHP-alt to the last PHP

<?php //define the receiver of the email $to = 'youraddress@example.com'; //define the subject of the email $subject = 'Test HTML email'; //create a boundary string. It must be unique //so we use the MD5 algorithm to generate a random hash $random_hash = md5(date('r', time())); //define the headers we want passed. Note that they are separated with \r\n $headers = 'From: webmaster@example.com\r\nReply-To: webmaster@example.com'; //add boundary string and mime type specification $headers .= '\r\nContent-Type: multipart/alternative; boundary=\'PHP-alt-'.$random_hash.'\''; //define the body of the message. ob_start(); //Turn on output buffering ?> --PHP-alt-<?php echo $random_hash; ?>  Content-Type: text/plain; charset='iso-8859-1' Content-Transfer-Encoding: 7bit  Hello World!!!  This is simple text email message.   --PHP-alt-<?php echo $random_hash; ?>  Content-Type: text/html; charset='iso-8859-1' Content-Transfer-Encoding: 7bit  <h2>Hello World!</h2> <p>This is something with <b>HTML</b> formatting.</p>  --PHP-alt-<?php echo $random_hash; ?>-- <? //copy current buffer contents into $message variable and delete current output buffer $message = ob_get_clean(); //send the email $mail_sent = @mail( $to, $subject, $message, $headers ); //if the message is sent successfully print 'Mail sent'. Otherwise print 'Mail failed'  echo $mail_sent ? 'Mail sent' : 'Mail failed'; ?> 
  • 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. 2026-05-10T22:09:00+00:00Added an answer on May 10, 2026 at 10:09 pm

    Rather than try and roll your own mailer, try e.g. PHPMailer. It has very good support for multipart/alternative. It’s much easier to integrate this than to roll your own solution. I’ve been there – after working endlessly around strange MIME problems, I’ve dropped my hand-made mailer, switched to this, and focused on other things in the time I’ve spared.

    In other words, don’t reinvent the wheel. Although doing it yourself can be a good challenge and you’ll learn a lot during the process, if you just want it to work, these guys have dealt with the complexity for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 195k
  • Answers 195k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Rick Strahl posted an article how to do this at… May 12, 2026 at 6:53 pm
  • Editorial Team
    Editorial Team added an answer check your APPEND_SLASH setting in the settings.py file more info… May 12, 2026 at 6:53 pm
  • Editorial Team
    Editorial Team added an answer What you're wanting sounds like an auditing service, not a… May 12, 2026 at 6:53 pm

Related Questions

I'm tryin to use some code to create a badge number for the iPhone
I am using DotNetOpenAuth to integrate openID in our web application. The code below
I am using the SharpZipLib open source .net library from www.icsharpcode.net My goal is
I am using ASP.NET to transmit a .jar file. This code works perfectly on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.