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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:41:10+00:00 2026-05-15T17:41:10+00:00

The code below has been sending CSVs to our print fulfillment folks for years.

  • 0

The code below has been sending CSVs to our print fulfillment folks for years. Beginning of the week the sysadmin switched from sendmail to qmail for reasons having to do with procmail recipes we want to run.

Probably not coincidentally we starting started hearing that the fulfillment folks were seeing empty CSVs even when others CCed on the mail saw the records. Folks with the issue were seeing the attachment and could open it but their MUI was listing it as 131 bytes or zero bytes.

We started sending to a Yahoo address with same results. However Gmail sees attachment with correct rows. Mind you this is all one CCed email with different results depending on mail clients.

I have gone over the code in vi and made sure there were no ^M chars or other control character junk.

Anyone seen this before? Any suggestions most welcome!

Thanks!

$message = "Here is the file (comma-separated values) of addresses for\n";
$message .= $pm_row['title'] . " Requests ($now_YmdHMS).\n\n";
$data_email = $pm_row['fulfillment_data_email'];
$data_email_cc = "$pm_row[fulfillment_data_email_cc],$developer_email";
$subject = $pm_row['title'] . " Requests ($now_YmdHMS)";
$random_hash = md5(date('r', time()));
$headers = "From: XXX <tourism@xxx.org>\r\nReply-To: tourism@xxx.org\r\nCc:$data_email_cc"; 
$headers .= "\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";
$attachment = chunk_split(base64_encode(file_get_contents($filename)));
$output = "
--PHP-mixed-$random_hash; 
Content-Type: multipart/alternative; boundary='PHP-alt-$random_hash'
--PHP-alt-$random_hash
Content-Type: text/plain; charset='iso-8859-1'
Content-Transfer-Encoding: 7bit

$message

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

$message

--PHP-alt-$random_hash--

--PHP-mixed-$random_hash
Content-Type: application/zip; name=$now_YmdHMS.$pm_row[handle].csv
Content-Transfer-Encoding: base64 
Content-Disposition: attachment 

$attachment
--PHP-mixed-$random_hash--";

mail($data_email, $subject, $output, $headers);
  • 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-15T17:41:10+00:00Added an answer on May 15, 2026 at 5:41 pm

    I think it is a CR/LF problem, which is a known Bug in php for about three years and -as far as I know- hasn’t been fixed up to now:

    http://bugs.php.net/bug.php?id=15841

    The generated Email isn’t valid (explanation can be found here: http://cr.yp.to/docs/smtplf.html ), due to using a non-RFC-conform linebreak-format. Other MTA like sendmail and postfix correct this problem automatically; qmail doesn’t.

    You can either: write correct mails with php (lol), or ask your qmail-administrator to use the QmailScanner ( http://qmail-scanner.sourceforge.net/ ), which is doing this job too.

    The best solution would be to deinstall php and use perl in the future duck 😉

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

Sidebar

Related Questions

I have code below which has been working on devices of type Windows Mobile
With reference to the code below, once a block has been put into an
I've been using FB Connect for some time now. The code below has worked
I've been testing sending and receiving broadcasts in my application but I have a
In the code below I have a StreamReader reading from a network stream. This
Hello i have the code below to upload pictures for my application. I will
I just want to confirm something as my understanding has been shaken by a
I have a simple self hosted WCF Console windows app, and I can connect
This is my fist stackoverflow post so please be gentle with me! I'm sure
I have the following program where two variables are to be passed by reference

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.