Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 673
  • Last Modified:

Using mail fuction, getting occasional exclamation marks? base64-encoding the solution? How?

I've got a script sending email like this:

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To:' . $mem_email . "\r\n";
$headers .= 'From: "Chris, Mysite" <admin@mysite.com>' . "\r\n";
mail("$mem_email","Newsletter","
Hi $screen_name,<br /><br />
$news
","$headers");

And I am sending them an html mail.  I find it works best if I don't have any line breaks (other than <br>'s, so I don't get unexpected line spacing.

But when I send it, I get an occasional exclamation mark  ! and then a space afterwords. Then the text resumes ok.

Reading through the php site, under 'bugs', is says this is a sendmail issue and that the solution is  "to use base64-encoding".

How do I use base64-encoding? and will that work with MS outlook ok (I use eudora myself).

Thanks,

Chris
0
St_Aug_Beach_Bum
Asked:
St_Aug_Beach_Bum
  • 4
  • 3
1 Solution
 
EMB01Commented:
About your code, try removing some unnecessary quotes and such... Also escaped some quotes...
$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$headers .= "To:" . $mem_email . "\r\n";
$headers .= "From: \"Chris, Mysite\" <admin@mysite.com>" . "\r\n";
mail($mem_email,"Newsletter","Hi $screen_name,<br /><br />$news",$headers);

Open in new window

0
 
EMB01Commented:
For the record, I don't think you need to base64 as you already have the content type set as HTML.
0
 
St_Aug_Beach_BumAuthor Commented:
Thank you both, but I am still getting the exclamation point thrown into the text.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
St_Aug_Beach_BumAuthor Commented:
Ok, managed to redo my email so I can put some line breaks in it, and it still format ok, and that resolves this problem.
0
 
EMB01Commented:
I'm sorry, what did you do to resolve the issue? Could you post your code?
0
 
St_Aug_Beach_BumAuthor Commented:
Hi EMB01,

I ended up changing the text of the email so that it would linclude line breaks, rather than making a code change.  It seems that the issue was related to how long a line could be when sending an email through sendmail.

I tried the suggestion you made here and it did not make a difference, so I ended up tackling this from another direction, ie, finding a way to make an eol ok in the email without messing up the layout.
0
 
EMB01Commented:
Oh, sorry I couldn't help. I always use a local variable when sending mail, like:
$message = "Hi " . $screen_name . ",<br /><br />" . $news;

Then:
mail ($mem_email, $message, $headers);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now