For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > June 2005 > PHP Mail command









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author PHP Mail command
Ron Piggott

2005-06-06, 3:55 am

I have a mail() question. Take a look at this sample code below: Pay
attention the $message variable

<?
$to="ron.php@actsministries.org";
$subject="Test e-mail";
$headers = "From: ron.php@actsministries.org";

$message = "

But prove yourselves doesn't and not only "hears".

";

mail($to, $subject, $message, $headers);
?>

I have a mySQL database of quotations that one is randomly being e-mailed
out daily. The trouble is that some quotations have " marks in this such as
the example above. This bit of code doesn't work because the computer is
looking for a ; following the ". Elsewhere in the quotation database there
is the use of ' . Is there a way to do a search and replace for " to ' ?
The e-mails that are sent out are plain text e-mails.

I have used the

$quotation = mysql_real_escape_string($quotation);

to be able to insert quotes with ' into the mySQL table; is there a similar
way to get around this problem I am having?

Thanks :)

Ron

PS It is a really funny e-mail I just wrote and sure is computer in nature
when entire words consist of ; " ' GRIN
David Robley

2005-06-06, 3:56 am

Ron Piggott wrote:

> I have a mail() question. Take a look at this sample code below: Pay
> attention the $message variable
>
> <?
> $to="ron.php@actsministries.org";
> $subject="Test e-mail";
> $headers = "From: ron.php@actsministries.org";
>
> $message = "
>
> But prove yourselves doesn't and not only "hears".
>
> ";
>
> mail($to, $subject, $message, $headers);
> ?>
>
> I have a mySQL database of quotations that one is randomly being e-mailed
> out daily. The trouble is that some quotations have " marks in this such
> as
> the example above. This bit of code doesn't work because the computer is
> looking for a ; following the ". Elsewhere in the quotation database
> there
> is the use of ' . Is there a way to do a search and replace for " to ' ?
> The e-mails that are sent out are plain text e-mails.
>
> I have used the
>
> $quotation = mysql_real_escape_string($quotation);
>
> to be able to insert quotes with ' into the mySQL table; is there a
> similar way to get around this problem I am having?


I suspect you want str_replace()


Cheers
--
David Robley

Useless Invention: Brown undershorts.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com