Sending mail with php and html -


i using phpmailer send normal pre-defined mails , works fine. want is, connect texteditor php script can send nice html mails. texteditor template ckeditor. enter image description here

everything write in textedtior written html tags enter image description here

then have php script phpmailer send mail. have been thinking of maybe posting html tags post method , getting them in php script. maybe not best idea, , if dont know how post stuff out of input tags.

any appreciated.

ps. php code

date_default_timezone_set('etc/utc'); require '../phpmailerautoload.php'; $mail = new phpmailer; $mail->issmtp(); $mail->smtpdebug = 2; $mail->debugoutput = 'html'; $mail->host = 'smtp.gmail.com'; $mail->port = 587; $mail->smtpsecure = 'tls'; $mail->smtpauth = true; $mail->username = "??????@gmail.com"; $mail->password = "?????"; $mail->setfrom('????@gmail.com', 'first last'); $mail->addreplyto('????@gmail.com', 'first last'); $mail->addaddress('???@gmail.com', 'john doe'); $mail->subject = 'phpmailer gmail smtp test'; $mail->msghtml(file_get_contents('contents.html'), dirname(__file__)); $mail->altbody = 'this plain-text message body'; $mail->addattachment('images/phpmailer_mini.png'); if (!$mail->send()) {     echo "mailer error: " . $mail->errorinfo; } else {     echo "message sent!"; } 

and html code.. lot of done script got template

<html> <head>     <meta charset="utf-8">     <title>???</title>     <script src="../ckeditor.js"></script>     <script src="js/sample.js"></script>     <link rel="stylesheet" href="css/samples.css">     <link rel="stylesheet" href="toolbarconfigurator/lib/codemirror/neo.css"> </head> <body id="main">   <form class="newsletter-signup" form action="http://??????gmail.php" method="post"> <main>         <div class="adjoined-top">             <div class="grid-container">                 <div class="grid-width-100">                     <div id="editor">                     </div>                 </div>             </div>         </div>   </main>   <input type="submit" class="btn btn-default btn-sand" value="subscribe"> </form> <button onclick="loadpages()">click me</button> <script>     function loadpages(){         //document.getelementsbyclassname('lulul')[0].setattribute('src', "http://??????/gmail.php");         document.getelementsbyclassname('lulul')[0].setattribute('name',"content");     } </script> <script>     initsample(); </script>  </body> </html> 

basically main idea of using full html body see html output correctly. here example

<!doctype html public "-//w3c//dtd html 4.01 transitional//en"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#ffffff" text="#000000">         body text<br> <div class="moz-signature"><i><br> <br> the<br> frenks<br> </i></div> </body> </html> 

this execute html in right way inside mail body content :)

for example not work if pass this!

<b>the frenks</b> 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -