/ Published in: PHP

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
1 <?php 2 function mail_from() { 4 return $emailaddress; 5 } 6 7 function mail_from_name() { 8 $sendername = "1stWebDesigner.com - Dainis"; 9 return $sendername; 10 } 11 12 add_filter('wp_mail_from','mail_from'); 13 add_filter('wp_mail_from_name','mail_from_name'); 14 ?> 1 <html></span></h2> 2 <pre><head> 3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 4 </head> 5 <body> 6 <table style="font-family: Verdana,sans-serif; font-size: 11px; color: #374953; width: 600px;"> 7 <tr> 8 <td align="left"><a href="<?php bloginfo('url'); ?>" title="MyBlog"><img src="<?php bloginfo('url'); ?>/logo.png" alt="MyBlog" style="border: none;" ></a></td> 9 </tr> 10 <tr> 11 <td> </td> 12 </tr> 13 <tr> 14 <td align="left">Yo, <?php echo $name; ?>.<br />How are you?</td> 15 </tr> 16 <tr> 17 <td> </td> 18 </tr> 19 <tr> 20 <td>I've recieved your message and we'll answer it soon!</td> 21 </tr> 22 <tr> 23 <td> </td> 24 </tr> 25 <tr> 26 <td align="left" style="background-color: #aeaeae; color:#FFF; font-size: 12px; font-weight: bold; padding: 0.5em 1em;">Original Message</td> 27 </tr> 28 <tr> 29 <td><?php echo $message; ?></td> 30 </tr> 31 <tr> 32 <td> </td> 33 </tr> 34 <tr> 35 <td align="center" style="font-size: 10px; border-top: 1px solid #c10000;"> 36 <p><i>Thank you!</i><br /><b>MyBlog</b> - <br /><?php bloginfo('url'); ?></p> 37 </td> 38 </tr> 39 </table> 40 </body> 41 </html> And we call this function with our contact form: 1 <?php 2 function contactMail($post) { 3 $attachments = ""; 4 $subject = "[MyBlog] Contact"; 5 $name = $post["name"]; 6 $email = $post["email"]; 7 $message = $post["message"]; 9 include(TEMPLATEPATH . '/_mails/contact.html'); 12 "; "; 15 $headers .= "MIME-Version: 1.0 "; 16 $headers .= "Content-Type: text/html; charset=UTF-8 "; "; 18 //$headers .= "BCC: [email protected] "; 19 wp_mail( $email, $subject, $message, $headers, $attachments ); 20 } 21 ?>
Comments
