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

  • SEARCH
  • Home
  • 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 155061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:05:20+00:00 2026-05-11T10:05:20+00:00

Here’s the script that’s builds/sends the email: $boundary = md5(date(‘U’)); $to = $email; $subject

  • 0

Here’s the script that’s builds/sends the email:

$boundary = md5(date('U'));  $to = $email; $subject = 'My Subject';  $headers = 'From: myaddress@mydomain.com' . '\r\n'.            'X-Mailer: PHP/'.phpversion() .'\r\n'.            'MIME-Version: 1.0' . '\r\n'.            'Content-Type: multipart/alternative; boundary=--$boundary'. '\r\n'.            'Content-Transfer-Encoding: 7bit'. '\r\n';  $text = 'You really ought remember the birthdays';      $html = '<html>     <head>       <title>Birthday Reminders for August</title>     </head>     <body>       <p>Here are the birthdays upcoming in August!</p>       <table>         <tr>           <th>Person</th><th>Day</th><th>Month</th><th>Year</th>         </tr>         <tr>           <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>         </tr>         <tr>           <td>Sally</td><td>17th</td><td>August</td><td>1973</td>         </tr>       </table>     </body>     </html>     ';  $message = 'Multipart Message coming up' . '\r\n\r\n'.        '--'.$boundary.        'Content-Type: text/plain; charset=\'iso-8859-1\'' .        'Content-Transfer-Encoding: 7bit'.        $text.         '--'.$boundary.         'Content-Type: text/html; charset=\'iso-8859-1\''.         'Content-Transfer-Encoding: 7bit'.         $html.        '--'.$boundary.'--';    mail('toAddress@example.com', $subject, $message, $headers); 

It sends the message just fine, and my recipient receives it, but they get the whole thing in text/plain instead of in multipart/alternative. Viewing the source of the received message gives this (lots of cruft removed):

Delivered-To: myrecipient@example.com Received: by 10.90.100.4 with SMTP id x4cs111413agb;     Wed, 25 Mar 2009 16:39:32 -0700 (PDT) Received: by 10.100.153.6 with SMTP id a6mr85081ane.123.1238024372342;     Wed, 25 Mar 2009 16:39:32 -0700 (PDT) Return-Path: <xxx@xxxx.com> --- snip --- Date: Wed, 25 Mar 2009 17:37:36 -0600 (MDT) Message-Id: <200903252337.n2PNbaw2019541@www.xxxxxxx.com> To: trevor@saturdayplace.com Subject: My Subject From: me@mydomain.com X-Mailer: PHP/4.3.9 MIME-Version: 1.0 Content-Type: text/plain; boundary='--66131caf569f63b24f43d529d8973560' Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 25 Mar 2009 23:38:30.0531 (UTC) FILETIME=[CDC4E530:01C9ADA2] X-TM-AS-Product-Ver: SMEX-8.0.0.1181-5.600.1016-16540.005 X-TM-AS-Result: No--4.921300-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No   Multipart Message coming up  --66131caf569f63b24f43d529d8973560 Content-Type: text/plain; charset='iso-8859-1' Content-Transfer-Encoding: 7bit  You really ought remember the birthdays  --66131caf569f63b24f43d529d8973560 Content-Type: text/html; charset='iso-8859-1' Content-Transfer-Encoding: 7bit  <html>     <head>       <title>Birthday Reminders for August</title>     </head>     <body>       <p>Here are the birthdays upcoming in August!</p>       <table>         <tr>           <th>Person</th><th>Day</th><th>Month</th><th>Year</th>         </tr>         <tr>           <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>         </tr>         <tr>           <td>Sally</td><td>17th</td><td>August</td><td>1973</td>         </tr>       </table>     </body>     </html>   --66131caf569f63b24f43d529d8973560-- 

It looks like the content-type header is getting changed along the way from multipart/alternative to text/plain. I’m no sysadmin, so if this is a sendmail issue I’m in way over my head. Any suggestions?

  • 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-11T10:05:21+00:00Added an answer on May 11, 2026 at 10:05 am

    The line

    'Content-Type: multipart/alternative; boundary=--$boundary'. '\r\n'. 

    should be

    'Content-Type: multipart/alternative; boundary=$boundary'. '\r\n'. 

    You don’t include the dashes in the header.

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

Sidebar

Related Questions

Here's a query that works fine: SELECT rowid as msg_rowid, a, b, c FROM
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior
Here's a coding problem for those that like this kind of thing. Let's see
Here is the scenario: I'm writing an app that will watch for any changes
Here's what I'm trying to accomplish with this program: a recursive method that checks
Here is a simple timepicker to jQuery UI's datepicker <script type=text/javascript> /* <![CDATA[ */
Here's the setup - I have a view that lists products. On that same
Here is a scenario: User installs .NET application that you have made. After some

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.