| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: SureMails |
| 4 |
* Plugin URI: https://suremails.com |
| 5 |
* Description: A plugin to connect and send emails via SMTP connections. |
| 6 |
* Author: SureMails |
| 7 |
* Author URI: https://suremails.com/ |
| 8 |
* Version: 0.0.4 |
| 9 |
* License: GPLv2 or later |
| 10 |
* Text Domain: suremails |
| 11 |
* Requires at least: 5.4 |
| 12 |
* Requires PHP: 7.4 |
| 13 |
* |
| 14 |
* @package suremails |
| 15 |
*/ |
| 16 |
|
| 17 |
if ( ! defined( 'ABSPATH' ) ) { |
| 18 |
exit; // Exit if accessed directly. |
| 19 |
} |
| 20 |
|
| 21 |
define( 'SUREMAILS_FILE', __FILE__ ); |
| 22 |
define( 'SUREMAILS_BASE', plugin_basename( SUREMAILS_FILE ) ); |
| 23 |
define( 'SUREMAILS_DIR', plugin_dir_path( SUREMAILS_FILE ) ); |
| 24 |
define( 'SUREMAILS_PLUGIN_DIR', plugin_dir_path( __DIR__ ) ); |
| 25 |
define( 'SUREMAILS_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
| 26 |
define( 'SUREMAILS_VERSION', '0.0.4' ); |
| 27 |
define( 'SUREMAILS', 'suremails' ); |
| 28 |
|
| 29 |
require_once SUREMAILS_DIR . 'loader.php'; // Include the Loader file. |
| 30 |
|
| 31 |
require_once SUREMAILS_DIR . 'inc/utils/emails/handler/mail-handler.php'; |
| 32 |
|
| 33 |
// Define wp_mail if it does not exist. |
| 34 |
if ( ! function_exists( 'wp_mail' ) ) { |
| 35 |
/** |
| 36 |
* Override the wp_mail function to use the SureMails MailHandler. |
| 37 |
* |
| 38 |
* @param string|array $to Recipient email address(es). |
| 39 |
* @param string $subject Email subject. |
| 40 |
* @param string $message Email message. |
| 41 |
* @param string|array $headers Optional. Additional headers. |
| 42 |
* @param array $attachments Optional. Attachments. |
| 43 |
* @return bool|null Whether the email was sent successfully. |
| 44 |
*/ |
| 45 |
function wp_mail( $to, $subject, $message, $headers = '', $attachments = [] ) { |
| 46 |
$atts = apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ); |
| 47 |
return SureMails\Inc\Utils\Emails\Handler\MailHandler::handle_mail( $atts ); |
| 48 |
} |
| 49 |
} |
| 50 |
|