Horrible Email HTML troubles

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
blobman
Forum Newbie
Posts: 9
Joined: Wed Nov 02, 2005 10:52 pm

Horrible Email HTML troubles

Post by blobman »

Hello,

I have figured out how to email with html from a php script, although i am getting
X-NAS-Language: English X-NAS-Bayes: #0: 7.38197E-108; #1: 1 X-NAS-Classification: 0 X-NAS-MessageID: 71 X-NAS-Validation: {4122194F-EB3B-4CDD-8248-92C555CF49A9}
at the top of my email.

How do I get rid of that crap? I looked all over the internet, and all of the examples send this with the email.

Please help.

Thank you!
-Cameron
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Those are likely added by your server, and are out of your control.. but your headers passed to the mail function may have too many extra carriage returns in it... post your code.
blobman
Forum Newbie
Posts: 9
Joined: Wed Nov 02, 2005 10:52 pm

Post by blobman »

$headers .= "Content-Type: text/html\r\n";

was the header, along with some reply to stuff.

Then I pretty much had:

message = "
Sent from: $yourname <br> (at first I used \n, but then when using the html that wouldnt work)
Link: $link \<br>

etc etc etc"

I don't have the exact script anymore because I gave up and put it back to plain text, but I am having a lot of difficulty writing php emails. At first I had enough trouble using line skipts.

The only reason I went with html was to add some links in the actual email, because some email programs don't automatically make them links. If theres another way to do that, hit me up.
blobman
Forum Newbie
Posts: 9
Joined: Wed Nov 02, 2005 10:52 pm

Post by blobman »

So there is no fix then?
Charles256
DevNet Resident
Posts: 1375
Joined: Fri Sep 16, 2005 9:06 pm

Post by Charles256 »

google phpmailer. install that.takes like 5 seconds and 7 seconds to figure out how to use. it overrides those headers sent by your host ;)
blobman
Forum Newbie
Posts: 9
Joined: Wed Nov 02, 2005 10:52 pm

Post by blobman »

Thanks Charles, I will check that out
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post by jayshields »

blobman, post your full code, you may have too many carriage returns after the reply to bit aswell...

remember to use php tags!
blobman
Forum Newbie
Posts: 9
Joined: Wed Nov 02, 2005 10:52 pm

Post by blobman »

feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


X-NAS-Language: English X-NAS-Classification: 0 X-NAS-MessageID: 96 X-NAS-Validation: {4122194F-EB3B-4CDD-8248-92C555CF49A9}
Is what I get from a simple script i got off the internet similar to mine.

Code: Select all

<?php
$to = 'EMAIL';
$subject = 'Wakeup bob!';
$message = '<b>yo</b>, whassup?';
$headers = "From: admin@cameronperry.com\r\n" . "Content-Type: text/html\r\n";

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


feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Last edited by blobman on Sun Nov 04, 2007 11:49 pm, edited 2 times in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

have you tried removing the last \r\n from your header variable?
blobman
Forum Newbie
Posts: 9
Joined: Wed Nov 02, 2005 10:52 pm

Post by blobman »

Wow, that worked

I though I had it withou the \r\n at one point

Well thank you very much for the assistance, this was driving me crazy.

Have a good weekend,
Cameron
Post Reply