echo '<p>Thank you for subscribing!</p>';
// Admin menu add_action('admin_menu', 'mymail_admin_menu'); function mymail_admin_menu() add_menu_page('MyMail', 'MyMail', 'manage_options', 'mymail', 'mymail_admin_page'); mymail wordpress
require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); add_action('after_switch_theme', 'mymail_create_table'); // Shortcode: [mymail_form] function mymail_subscription_form() ob_start(); ?> <form method="post" class="mymail-form"> <input type="email" name="mymail_email" placeholder="Your email address" required> <input type="text" name="mymail_name" placeholder="Your name (optional)"> <input type="submit" name="mymail_subscribe" value="Subscribe"> <?php wp_nonce_field('mymail_subscribe_action', 'mymail_nonce'); ?> </form> <?php return ob_get_clean(); echo '<p>Thank you for subscribing
<hr style="margin: 30px 0;">
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>MyMail Newsletter</title> <style> body font-family: Arial, sans-serif; background: #f4f4f4; margin: 0; padding: 0; .container max-width: 600px; margin: 20px auto; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 5px rgba(0,0,0,0.1); .header background: #0073aa; color: #fff; padding: 20px; text-align: center; .content padding: 20px; line-height: 1.6; .footer background: #eee; padding: 15px; text-align: center; font-size: 12px; color: #777; .button display: inline-block; background: #0073aa; color: #fff; padding: 10px 20px; text-decoration: none; border-radius: 4px; @media only screen and (max-width: 600px) .container width: 100% !important; </style> </head> <body> <div class="container"> <div class="header"> <h1>📧 MyMail Newsletter</h1> </div> <div class="content"> <h2>Hello, [Subscriber Name]!</h2> <p>Here's your latest update from our website.</p> <h3>📝 Featured Post</h3> <p>Check out our newest article: <strong>10 Ways to Grow Your Email List</strong></p> <a href="https://yourwebsite.com/article" class="button">Read More →</a> ?php echo count($subscribers)
<p>Stay tuned for more updates!</p> </div> <div class="footer"> <p>You received this email because you subscribed at our website.</p> <p><a href="[Unsubscribe Link]">Unsubscribe instantly</a> | <a href="[Web Version Link]">View in browser</a></p> <p>© <?php echo date('Y'); ?> Your Company Name. All rights reserved.</p> </div> </div> </body> </html> | If you want... | Use... | |----------------|---------| | No plugins, full control | Custom code (Option 1) | | Professional features | MailPoet plugin (Option 2) | | Ready-made email design | HTML template (Option 3) |
?> <div class="wrap"> <h1>MyMail Newsletter</h1> <h2>Subscribers (<?php echo count($subscribers); ?>)</h2> <ul> <?php foreach ($subscribers as $sub): ?> <li><?php echo esc_html($sub->email); ?> (<?php echo esc_html($sub->name); ?>)</li> <?php endforeach; ?> </ul>