Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
programmieren:wordpress:wp_mail_verschicken [2019/08/20 22:40] – created jgehrkeprogrammieren:wordpress:wp_mail_verschicken [2022/12/17 12:28] (current) – external edit 127.0.0.1
Line 41: Line 41:
 die Funktionen ''mail_message( ... )'' und ''mail_template( ... )'' geben HTML zurück. Diese nutze ich, dass die Funktionen nicht zu groß und unübersichtlich werden. Gerade ein Newsletter-Template kann sehr viele Zeilen Code enthalten. die Funktionen ''mail_message( ... )'' und ''mail_template( ... )'' geben HTML zurück. Diese nutze ich, dass die Funktionen nicht zu groß und unübersichtlich werden. Gerade ein Newsletter-Template kann sehr viele Zeilen Code enthalten.
  
-Dies könnte so aussehen für die ''mail_template( ... )'' :+Dies könnte so aussehen für die ''mail_message( ... )'' :
  
 <code php> <code php>
 /** /**
- Das HTML Template für die Mail-Message+ * HTML Template der Message (nur innerer Block)
  *  *
- * @param  string $message      Die Nachricht im HTML Block+ * @param  int $post_id   Post-ID
  *  *
- * @return string               Komplette HTML E-Mail+ * @return string         HTML-Block der Nachricht
  */  */
-function mail_template( $message = "" ){+function mail_message( $post_id ){
  return "  return "
- <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> + 
- <html xmlns=\"http://www.w3.org/1999/xhtml\"> + Folgender Beitrag wurde gerade veröffentlicht:<br /><br /> 
-     <head> + " . get_the_post_thumbnail( $post_id ) . "<br /> 
-         <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /> + <a href=\""get_permalink( $post_id ) . "\"> 
-         <title>A Simple Responsive HTML Email</title+ <strong>" . get_the_title$post_id ) . "</strong
-         <style type=\"text/css\"> + </a><br /><br />
-         body {margin: 0; padding: 0; min-width: 100%!important;+
-         .content {width: 100%; max-width: 600px;} +
-         </style> +
-     </head> +
-     <body bgcolor=\"#f8f8f8\"> +
-         <table width=\"100%\" bgcolor=\"#f6f8f1\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"> +
-             <tr> +
-                 <td> +
-                     <table class=\"content\" bgcolor=\"#ffffff\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"> +
-                         <tr> +
-                             <td style=\"font-family:sans-serif; font-size:15px; line-height:24px; color:#555555;\"> +
- " . $message . " +
-                             </td+
-                         </tr> +
- <tr> +
- <td style=\"font-family:sans-serif; font-size:15px; line-height:24px; color:#555555;\"> +
- <a href=\"http://www.webadresse.de/agb\">AGB</a> | <a href=\"http://www.webadresse.de/impressum\">Impressum</a> +
- </td> +
- </tr> +
- <tr> +
- <td style=\"font-family:sans-serif; font-size:12px; line-height:24px; color:#555555;\"> +
- &nbsp; <br /> +
- &copy; " . date'Y' ) . " Copyright<br /> +
- &nbsp; <br /> +
- </td> +
- </tr> +
-                     </table> +
-                 </td> +
-             </tr> +
-         </table> +
-     </body> +
- </html>+
  ";  ";
 } }
 </code> </code>

Page Tools