| Linode Forum https://forum.linode.com/ |
|
| [SOLVED] Problems switching from sendmail to postfix https://forum.linode.com/viewtopic.php?f=11&t=3798 |
Page 1 of 2 |
| Author: | dcelasun [ Thu Jan 08, 2009 6:05 pm ] |
| Post subject: | [SOLVED] Problems switching from sendmail to postfix |
I've recently removed sendmail and installed postfix. "Almost" everything is fine. The transition was smooth. The problem is I cannot send an email with an attachment. I've tested it with a php script which was working flawlessly with sendmail. The mail (meaning headers, subject and body) is delivered correctly but there's no attachment. When I click "show original" in Gmail on the test mail I've sent with my script, I can see the attachment data I've created with Code: $attachment = chunk_split(base64_encode(file_get_contents('attachment.txt')));But there is no downloadable attachment.
What do you think is wrong? Thanks in advance. |
|
| Author: | SteveG [ Thu Jan 08, 2009 7:46 pm ] |
| Post subject: | |
That's really weird, because neither sendmail nor postfix knows anything about attachments - it's all just data to them. |
|
| Author: | dcelasun [ Fri Jan 09, 2009 4:41 am ] |
| Post subject: | |
Well, the script is basically a cron job that sends me the apache logs every night at 10 pm. Here's the code I'm using: Code: <?phpAny idea what's wrong? |
|
| Author: | saman007uk [ Fri Jan 09, 2009 12:51 pm ] |
| Post subject: | |
Have you tried saving your message (including headers, etc in appropriate format) and sending it directly through sendmail (even Postfix has a sendmail command) to see what happens? Code: /usr/sbin/sendmail -i < email.txt |
|
| Author: | dcelasun [ Fri Jan 09, 2009 1:22 pm ] |
| Post subject: | |
How do I save the mail in a "proper" format? |
|
| Author: | saman007uk [ Fri Jan 09, 2009 2:04 pm ] |
| Post subject: | |
It sould be a simple text file. It should start with one header per line, then a blank line and then the message body. If you go into Gmail and then choose "Show Origininal" (from the menu that comes up when you click on the arrow next to Reply) you'll see what I mean. |
|
| Author: | dcelasun [ Fri Jan 09, 2009 2:40 pm ] |
| Post subject: | |
Well, I tried that and the mail didn't even get delivered. Here's the mail.txt I've used: Code: Subject: [APACHE ERRORS] 8 Jan 2009 And here's the command I've used to send the mail: Code: /usr/sbin/sendmail -i < mail.txt -t some@domain.com What's next? |
|
| Author: | saman007uk [ Fri Jan 09, 2009 2:50 pm ] |
| Post subject: | |
It should be (I had assumed that you had the receipeints as a header): Code: /usr/sbin/sendmail -i some@domain.com < mail.txt |
|
| Author: | dcelasun [ Fri Jan 09, 2009 2:55 pm ] |
| Post subject: | |
I had them as a header, but the MTA complained that recipients should be given in the command line and not as a header. I'll try it now. |
|
| Author: | dcelasun [ Fri Jan 09, 2009 3:00 pm ] |
| Post subject: | |
It still didn't get delivered. Here are the relevant lines from /var/log/mail.log: Code: Jan 9 20:55:16 ubuntu postfix/pickup[11413]: 2D5EAE1C7: uid=1001 from=<dcc24> It seems like it reached gmail (status=sent) but it's nowhere to be found in gmail. |
|
| Author: | SteveG [ Fri Jan 09, 2009 3:51 pm ] |
| Post subject: | |
dcelasun wrote: I had them as a header, but the MTA complained that recipients should be given in the command line and not as a header. I'll try it now.
You probably need both. Gmail may be dropping it because there's no "To:" header. |
|
| Author: | dcelasun [ Fri Jan 09, 2009 3:56 pm ] |
| Post subject: | |
Still no luck. Btw, I'm assuming the php code is ok, because it previously worked fine with sendmail. Now that I'm using postfix that code delivers only an empty mail. No text in body and no attachment. Here's the weird thing, when I click "show original" I can see the body text and the attachment (in chunks, of course), but gmail doesn't display either of them. What should I do? Does anyone have a php mail-with-attachment script I can test? |
|
| Author: | SpinThis! [ Fri Jan 09, 2009 5:16 pm ] |
| Post subject: | |
Get rid of your \r carriage returns and it'll work. Postfix changes them into line feeds so it ends up breaking the script. Just tried your script with that modification and it worked for me. See: PHPBuilder http://www.phpbuilder.com/board/showthr ... t=10271531 |
|
| Author: | dcelasun [ Fri Jan 09, 2009 5:44 pm ] |
| Post subject: | |
Well, I tried removing \r's, still no luck. Here's the current code: Code: <?php |
|
| Author: | dcelasun [ Fri Jan 09, 2009 6:05 pm ] |
| Post subject: | |
Solved it! The problem is not on my side, it's Gmail causing this. I've just changed the "To" header to some other address which forwards all mail to my gmail and that's it! Everything was displayed fine. Here's the "show original" output at gmail. Any idea what's wrong? Code:
Any ideas? |
|
| Page 1 of 2 | All times are UTC-04:00 |
| Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |
|