metalx Posted August 25, 2009 Share Posted August 25, 2009 I want to send an HTML Email.. how to do so.. The email will contain some vars, images and texts sample image: http://themetalx.com/help.jpg Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/171709-html-email/ Share on other sites More sharing options...
Jezza Posted August 25, 2009 Share Posted August 25, 2009 Is this using PHP or do you just want to know how to post an email wth HTML in it? Quote Link to comment https://forums.phpfreaks.com/topic/171709-html-email/#findComment-905538 Share on other sites More sharing options...
Cetanu Posted August 25, 2009 Share Posted August 25, 2009 I don't know what the benefit of sending an Email with PHP would be, but to send an HTML email with formatting and text just: 1) Code a page of everything you want to send and format it the way you want it. 2) Ctrl + A to select everything on the page. 3) Ctrl + V to paste it into your email client. Make sure it's not in plain text editing when you paste it. 4) Send. I hope that helps...a little? Quote Link to comment https://forums.phpfreaks.com/topic/171709-html-email/#findComment-905543 Share on other sites More sharing options...
oni-kun Posted August 25, 2009 Share Posted August 25, 2009 Why does no one understand this? OP, you mean using mail() to send HTML inside the subject? <?php //define the receiver of the email $to = 'youraddress@example.com'; //define the subject of the email $subject = 'Test email'; //define the message to be sent. Each line should be separated with \n $message = "Hello World!\n\nThis is my first mail.<img src=\"http://img.com/img.jpg\"/> <b> I am html! </b> "; //define the headers we want passed. Note that they are separated with \r\n $headers = "From: webmaster@example.com\r\nReply-To: webmaster@example.com\r\n MIME-Version: 1.0"; //send the email $mail_sent = @mail( $to, $subject, $message, $headers ); //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" echo $mail_sent ? "Mail sent" : "Mail failed"; ?> And that should allow you to send HTML in an e-mail, mime set.. messy but correct example. Quote Link to comment https://forums.phpfreaks.com/topic/171709-html-email/#findComment-905562 Share on other sites More sharing options...
PravinS Posted August 25, 2009 Share Posted August 25, 2009 You can use mail class. I have attached the mail class file and copy below given code and set the values. <?php $nameto = ""; $emailto = ""; $emailalt = ""; include_once("class.phpmailer.php"); $Mail = new PHPMailer(); $Mail->Mailer = "mail"; $Mail->SetLanguage("en",""); $Mail->IsHTML(true); $Mail->Priority = 3; $Mail->Encoding = "8bit"; $Mail->CharSet = "iso-8859-1"; $Mail->From = ""; $Mail->FromName = ""; $Mail->Sender = ""; $Mail->WordWrap = 0; $Mail->Body = ""; $Mail->Subject = "" ; $Mail->AddAddress($emailto,$nameto); $Mail->Send(); ?> [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/171709-html-email/#findComment-905579 Share on other sites More sharing options...
metalx Posted August 25, 2009 Author Share Posted August 25, 2009 Thaks and i ment using mail() just as posted above.. And to add variables to it I only and $var where i want the variable to appear? thanks Quote Link to comment https://forums.phpfreaks.com/topic/171709-html-email/#findComment-906188 Share on other sites More sharing options...
oni-kun Posted August 25, 2009 Share Posted August 25, 2009 Thaks and i ment using mail() just as posted above.. And to add variables to it I only and $var where i want the variable to appear? thanks Yes, in the body of the message you can place variables or whatever you'd like, PHP will parse the variables for you and send the message, the client would see the HTML and the variable that PHP sent through the mail() function. Quote Link to comment https://forums.phpfreaks.com/topic/171709-html-email/#findComment-906195 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.