Danny159
12-12-2007, 01:17 PM
Hey
I am making a php application and i want the user to be able to put in the message box something but it can be in HTML so i did this and now when it sends it dosnt make it php even when i have this:
$headers .= "From: $company\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/html; image/jpeg;";
Can anyone help?
Dan
Xlusive
12-12-2007, 01:23 PM
Sorry, but i don't understand it fully.
Rephrase your question.
Danny159
12-12-2007, 01:37 PM
I'm basicly asking how you send HTML through php becasue mine dosent work
<?php
if($_GET['send'] == "yes"){
include("config.php");
$mail = $_POST['mail'];
$sub = $_POST['sub'];
$text = $_POST['text'];
/////////////////////
$headers .= "From: $company\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/html; image/jpeg;";
////////////////////
$mail_sent = @mail( $mail, $sub, $text, $headers );
echo $mail_sent ?
"<br /><div class='success'>Email sent to $mail</div>" :
"<br /><div class='failed'>Sending Failed, Please go back and try again.<br><a href='javascript:history.back();'>[Back?]</a></div>";
}
?>
arbet
12-12-2007, 01:56 PM
call the url with the Get method
file.php?send=1
Danny159
12-12-2007, 02:02 PM
No i know all that but its working fine and it send the email it just dosent show the HTML stuff in the email like if you put <font style""....... it wouldnt show the style in the email it would just be defalt
Steve_Arm
12-12-2007, 02:20 PM
try changing this line to:
$headers .= "Content-Type: text/html;";
Steve_Arm
12-12-2007, 02:59 PM
Well, does your client software display messages in HTML?
View the message source.
Danny159
12-12-2007, 03:02 PM
you mean set to HTML in the textfield?
orbitz
12-12-2007, 05:43 PM
no, Steve meant that some Email Application, users are given option to disable/enable messages in plain text/HTML.
If you send as HTML format, but the user set to plain text, he/she will see html codes instead of a nice html-formatted page.
Xlusive
12-12-2007, 06:34 PM
OK try this:
$to = $email;
$subject = $subject;
$message =
"enter the HTML here, remember to slash the quotes
";
$headers = "From: noreply@YOURDOMAIN.COM\r\n" .
'X-Mailer: PHP/' . phpversion() . "\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: text/html; charset=utf-8\r\n" .
"Content-Transfer-Encoding: 8bit\r\n\r\n";
// Send
mail($to, $subject, $message, $headers);
jstanden
12-12-2007, 10:19 PM
I'd really suggest using a better e-mail library when you get into HTML mail and MIME content parts.
My personal favorite so far is SwiftMailer (LGPL, excellent API).
Here's a link to their 'Sending HTML' examples:
http://www.swiftmailer.org/wikidocs/v3/tutorials/html
holmesa
12-14-2007, 07:35 PM
Same thread from the same author:
http://www.webhostingtalk.com/showthread.php?p=4855920
Danny159
12-15-2007, 05:42 AM
I have this fixed now... however it wont send to emails that are not on the server DNS... so say it was a you@hotmail.co.uk it will not send it to you but will send to me@mydomain.com
Why is this :S
Dan