Jump to content

mail() not doing tables (showing code: <table> etc..)


emopoops

Recommended Posts

im using the php mail() function to send an email and i got the email. except its formatted wrong like it looks like this:

<table bgcolor="black"><tr bgcolor="#111111"><td bgcolor="#222222"
width="60%"

etc.. u get it right?

i use gmail. now ive had images sent in mails to me. so why is this not working? i havent tested images but i figure that if table doesnt work img wont either. whats going on? is there a workaround? or is this what all mail sent by php mail() is bound to look like.

 

i have free hosting atm. or is it the hosting?

im clueless halp?!

Link to comment
Share on other sites

Are you saying that the HTML that you wish to be in the e-mail is just appearing as plain text? If thats the case then you need to set the header of the e-mail to say it is HTML.

 

$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=us-ascii\r\n"; 

Link to comment
Share on other sites

ok thanks you. that is something i needed to know. ok but this is what i have so far regarding the headers. how do i exactly incorporate it into what i have already?

$headers = 'From: noreply@socialemo.com' . "\r\n" .
    
    'Reply-To: noreply@socialemo.com' . "\r\n" .
    
    'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);

Link to comment
Share on other sites

$headers = "From: noreply@socialemo.com\r\n";
$headers .= "Reply-To: noreply@socialemo.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=us-ascii\r\n"; 
$headers .= "X-Mailer: PHP/" . phpversion();

 

Link to comment
Share on other sites

Its a good idea to get in the habit of googling things. You learn a lot more when you google things, because there is usually some information there that can pique your interest, which can lead you to google more things, and set of a chain of learning goodness.

 

This forum is a place to ask questions, but generally, the topic can't be fully explained in the scope of a forum post. Tutorials are good places to learn, and books are even better. The manual can usually solve 90% of your problems also, and reading the manual is another great way to learn.

 

Not to mention that people volunteer here to answer questions, and asking basic questions that are off topic from the original post (to a moderate extent) when the answer can be quickly gotten through google is asking a little much.

 

Remember, Google is your friend, and will never be mean to you.

Link to comment
Share on other sites

no ive googled it before. and i spend all day googling all the time. beleive me i know

 

also. does anyone know why its comiing up in the to: part of the email i recieve, my email adrss twice(it doesnt do this on other emails)

like to: me@blah.com, me@blah.com

 

??

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.