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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:09:02+00:00 2026-05-18T08:09:02+00:00

I just got PHP’s mail function to work properly in my test environment. I

  • 0

I just got PHP’s mail function to work properly in my test environment.

I have a PHP app that outputs a number of strings. It would be really nice to convert these strings to attachments (*.TXT -files) in an email, without first storing them on disk and having to read them back. Would this be possible in PHP?

  • 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-18T08:09:02+00:00Added an answer on May 18, 2026 at 8:09 am

    Yes, this is possible. You just need to make your email message a multipart message with the following syntax:

    MIME-Version: 1.0
    Content-Type: multipart/mixed; boundary=random-boundary
    
    This is the optional preamble of a multipart/mixed message.
    --random-boundary
    Content-Type: text/plain
    
    This is the main message body.
    --random-boundary
    Content-Type: text/plain
    Content-Disposition: attachment; filename=file.txt
    
    This is the content of the attached file.
    --random-boundary--
    This is the optional epilogue of a multipart/mixed message.
    

    Each part can then be described like any other message. But you should probably use a library that does this for you.

    Now if you’re using PHP’s mail function, the first two line would be the header and the rest would be the contents of that mail message. The boundary should be a random boundary so that the possibility of having that string with -- in front of it being in the contents of one part is very unlikely.

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

Sidebar

Related Questions

I just got Delphi 2009 and have previously read some articles about modifications that
I'm a C# and PHP developer. At work, I just got some classic ASP
I have the code below which I got from the php: mktime manual just
I am a newbie of PHP and just got informed that the developing process
I just got PHP-CLI working on my Windows machine so I could create scripts
I just got a few PHP projects which are using a similar kind of
i just got some more questions while learning PHP, does php implement any built
i just got an account at: http://www.whoisxmlapi.com/index.php#/whois-api-doc.php?rid=1 ive never parsed XML with c#, how
I guess I just got used to saying things like: x++ in PHP and
I just got a strange problem. I am including some files from my index.php,

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.