LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-20-2009, 10:28 AM   #1
Four
Member
 
Registered: Aug 2005
Posts: 298

Rep: Reputation: 30
sending mail in php to Israel mail servers


I have noticed that sending email using php doesn't work well to users with email accounts from servers in Israel (e.g. runbox.com). One fix was to change all "\r\n" to just "\n"; which worked but doesn't work for most sites like gmail accounts.

Is there a 1 fit all kinda thing way for emails to be properly parsed by all mail servers. The first header is properly parsed by Runbox accounts but using MIME boundaries are not parsed correctly unless all "\r" are removed (except for first header is fine)? But then that screws up gmail. Has anyone had similar problems?

Thank you.
 
Old 10-22-2009, 12:25 AM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
I wouldn't have thought you should be using '\r' at all, '\n' should be interpreted correctly per platform

cheers
 
Old 10-22-2009, 12:45 PM   #3
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,784

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
Quote:
Originally Posted by kbp
I wouldn't have thought you should be using '\r' at all, '\n' should be interpreted correctly per platform.

When communicating over the internet, you can't assume things like that.

See RFC 822, section 3.2
Quote:
field = field-name ":" [ field-body ] CRLF
If runbox.com doesn't work with \r\n, it has a bug; you'll have to work around it.
 
Old 10-22-2009, 06:39 PM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
What I was getting at was that on Windows '\n' becomes <cr><lf>, having an extra <cr> due to '\r' is not required

cheers
 
Old 10-23-2009, 10:37 AM   #5
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,784

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
That would only be the case when printing to the terminal or a file through a text-mode stream. The OP is about sending email, which means the data is going over a socket; usually neither side knows what platform the other is running, so things like line endings have to specified in the protocol.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending E-Mail From a Different Server Using PHP stevec Programming 6 08-02-2011 12:53 PM
can mail command be used to send mail onto global mail servers like yahoo etc dale_chip Linux - Newbie 4 08-12-2008 08:33 AM
PHP mail() sending as apache@ipaddress DukeLeto Linux - Software 1 04-13-2007 10:24 PM
Postfix mail transfer agent not sending mail locally or to other servers sketelsen Linux - Software 3 02-09-2006 11:16 AM
Sending mail with PHP and sendmail. davemar Linux - General 10 06-11-2004 04:48 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration