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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:30:25+00:00 2026-06-03T13:30:25+00:00

I am trying to send and email text or/and html versions.. What I do

  • 0

I am trying to send and email text or/and html versions..

What I do is this:

 $bodyHTML = "
 --PHP-alt-$random_hash 
 Content-Type: text/plain; charset='iso-8859-1' 
 Content-Transfer-Encoding: 7bit

http://example.com/app_dl.php?app_id=$_GET[app_id] to download your $app_name app \n\r
Want to get tons more hot apps for free! anywhere anytime? Download our app on http://example' \n\r\n\r
example.com team

  --PHP-alt-$random_hash 
 Content-Type: text/html; charset='iso-8859-1'
Content-Transfer-Encoding: 7bit

 <p><a href='http://example.com/app_dl.php?app_id=$_GET[app_id]'>Click Here</a> to download your $app_name app</p>
 <p>Want to get tons more hot apps for free! anywhere anytime? Download our app on <a href='http://example.com'>example.com</a></p>
 <br/>
 <p>example.com team</p>
  --PHP-alt-$random_hash ";
endif;

This is what I get:

--PHP-alt-f4b83c7072ae970392b44308a6c36109 Content-Type: text/plain; charset='iso-8859-

    1' Content-Transfer-Encoding: 7bit http://example.com/app_dl.php?app_id=35 to download your PhoneMates app Want to get tons more hot apps for free! anywhere anytime? Download our app on http://example.com' example.com team --PHP-alt-f4b83c7072ae970392b44308a6c36109 Content-Type: text/html; charset='iso-8859-1' Content-Transfer-Encoding: 7bit
        Click Here to download your PhoneMates app
        Want to get tons more hot apps for free! anywhere anytime? Download our app on example.com

   example.com team
    --PHP-alt-f4b83c7072ae970392b44308a6c36109  

The problem is that I see all those header lines..content type..and the text lines fail to be formatted with ‘\n\r’..

Also, I dont know if I can achieve the effect that if one version fails.. html or txt,,then the other version will appear.. thanks for the help

Here is some of the code:

 $random_hash = md5(date('r', time())); 
 $boundary="PHP-alt-".$random_hash;
 $headers = array ('From' => $from,
  'Content-Type'=>  'multipart/alternative',
   'boundary'=>$boundary,  
   'To' => $to,
    'Return-Path' => 'info@example.com',
   'Subject' => $subject);

Other details such as sender, pass , title,,arent relevant..so I didnt present them here..

  • 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-06-03T13:30:27+00:00Added an answer on June 3, 2026 at 1:30 pm

    Don’t roll your own MIME handling. Use a library instead of reinventing the wheel.

    I understand that Swift is the usual option in PHP land.

    That said, I suspect the problem has something to do with the whitespace before your MIME boundary markers and headers. Try removing it.

    Also your last MIME boundary is missing the -- at the end.

    Really, really, use a robust, well tested, third party library for this stuff. There is just too much fiddly stuff you can get wrong.

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

Sidebar

Related Questions

Rails 3 defaults to Content-Type: text/plain I'm trying to send and HTML email. How
I am trying to send an email with a plain text body and an
I am trying to send in PHP an HTML email but it always shows
I am trying to send some text in an email from my cocoa app
I'm trying to send an encrypted email with an attachment from PHP, however, my
I am trying to send a sample email from my rails application. this is
i found a way to send plain text email using intent: final Intent emailIntent
I am trying to send an email message with data collected from an html
I'm trying to send an email with html formatting, but when it arrives (in
I'm trying to send email with hebrew content/subject like so: $to = 'email@email.com'; $subject

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.