SEO, PHP and Javascript Web Dev

Search Engine Optimisation, Web Development and Network Administration Ramblings

-->
04 2008

Tip of the Week : Carriage Returns in PHP Plain Text Emails

Another quick tip for the archives. Carriage returns on lines in your view finishing with a php statement. Try sending these views as an email and somehow the resulting email does not look entirely correct. The carriage returns have not been passed through.

This is a quick, hackish, tip so I really didn’t get to the bottom of it. Either PHP or Zend mail or possibly savant 3 the templating engine has some error here.

e.g:


Hi  eprint($this->sUserName) ?>
Email sent by eprint($this->sSenderName) ?>

The carriage returns here will not be recognised in the plain text email you send, which I was sending using Zend mail. The above is an example of a plaintext template view I was using.

In order to fix this all I needed to ensure was that there is a character at the end of everyline before the carriage return. A space does the trick. As long as your line finished in an ordinary character everything works smoothly.

Share this Post:
  • Reddit
  • Sphinn
  • del.icio.us
  • Digg
  • e-mail
  • Mixx
  • Google
  • StumbleUpon

Related posts:

  1. Validate Unicode/UTF-8 Form Input (Language Specific Characters)
  2. Getting Spammed Like a Pro
  3. Tip of the Week : Nested Ternary Statement PHP

Tags: PHP, tip
« Tip of the Week : Nested Ternary Statement PHP
Tip of the Week : Resize images in Ubuntu »

Leave a Reply

-->
  • Photography