Hello guys, I'm trying to make my PHP mailing script mail an html webpage. I've pasted the page code but I've been getting alot of error pages complaining about the tags in the html code (style, table width, etc) How do I get around this?
kayblack 0
Newbie Poster
Recommended Answers
Jump to PostHey.
Could you please post the code you are using, and the error messages?
It helps with the debugging process, actually seeing what you are debugging :-]
Jump to PostOuch. You're trying to assign a whole bunch of uncleared HTML into that variable. Since you've wrapped it with double quotes and the HTML itself has double quotes you'll keep getting errors. A better way to do it would be to use heredocs.
Change your code to this,
Jump to PostYou've indented the closing MAILHTML; identifier. You need to leave this as I showed in the code. No indents allowed. Also, your mail function has an extra comma in it
if(mail($to,$subject,$message,, $headers, "From: $sendermail\n"))
Remove that as well. Problem solved.
Also, I suggest that you move …
Jump to PostAlso, I suggest that you move all that HTML to an external file and use something like file_get_contents() to extract the HTML. Much cleaner all around. Just a thought.
Agreed. There is nothing more annoying then having loads of HTML in your PHP scripts.
If you need to replace variables …
All 15 Replies
Atli 182
Posting Pro
kayblack 0
Newbie Poster
jomanlk 3
Junior Poster
kayblack 0
Newbie Poster
jomanlk 3
Junior Poster
Atli
commented:
Good advice :) +3
kayblack
commented:
Excellent! Fixed the problem with finality. +0
Atli 182
Posting Pro
kayblack 0
Newbie Poster
kayblack 0
Newbie Poster
kayblack 0
Newbie Poster
Atli 182
Posting Pro
jomanlk 3
Junior Poster
Atli 182
Posting Pro
kayblack 0
Newbie Poster
jomanlk 3
Junior Poster
Atli 182
Posting Pro
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.