Jump to content

Archived

This topic is now archived and is closed to further replies.

acidglitter

help! oh em gee

Recommended Posts

You know the mail() function? I'm using it like this...

mail("email", "subject","$crazy","From: me <email\n");

$crazy = all these html things.. But when I get the message, it puts things like (b) instead of actually being bold.. How can I make it show up right instead of showing the code??

Share this post


Link to post
Share on other sites
[code]<?php
// email address here
$to= "email@example.com";
// The subject
$subject = "Enter your subject here";
// The message
$message = "<b>Enter your message here</b><br>";
$from="your_email_here@test.com";
mail($to, $subject, $message, "From: $from");
?>[/code]

Share this post


Link to post
Share on other sites
Use the code i have provided you have to set the headers to get the mail to send proper html formated text ok.

[code]
<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = '<b>put you code here ok</b>';
$headers =  'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>
[/code]

Share this post


Link to post
Share on other sites
If you are going to send html in the email then you might want to use something like this.

[code]
<?php
$to = "someone@something.com";
$subject = "Something";
$message = "<html>
<head><title>Something</title></head>
<body>
<table width="600">
  <tr>
    <td>You can put something<b>here</b></td>
  </tr>
</table>
</body>
</html>";

$knownsender = "you@yoursite.com";//make sure that this an email address that is known to the server
$headers = "FROM: $knownsender\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: multipart/alternative;\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding: 7bit";
$headers .= "\r\n";

if (mail($to, $subject, $message, $headers)) {
  echo "Your mail was sent to $to";
}else{
  echo "Unable to send the message";
}     
?>[/code]

Also, it is important to rember that you should keep the width of your tables to no more then 600.

Good Luck,
Tom

Share this post


Link to post
Share on other sites

×

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.