vodanh1213
Forum Replies Created
-
Hi @gr1ns
I apologize for the confusion in my previous response. You’re absolutely right about the
$this
context issue. Here’s the corrected code snippet that properly instantiates the ProvidersRepository without requiring a class context:add_action('phpmailer_init', function($phpmailer) {
$repository = new \SolidWP\Mail\Repository\ProvidersRepository();
$default_provider = $repository->get_active_provider();
if (!is_object($default_provider) || $default_provider->validation() !== true) {
return;
}
// Set email sender details with REQUEST override
$from_email = isset($_REQUEST['from_email']) ? sanitize_email($_REQUEST['from_email']) : $default_provider->get_from_email();
$from_name = isset($_REQUEST['from_name']) ? sanitize_text_field($_REQUEST['from_name']) : $default_provider->get_from_name();
// Configure PHPMailer
$phpmailer->Mailer = 'smtp';
$phpmailer->From = $from_email;
$phpmailer->FromName = $from_name;
$phpmailer->Sender = $from_email;
$phpmailer->AddReplyTo($from_email, $from_name);
// SMTP settings
$phpmailer->Host = $default_provider->get_host();
$phpmailer->SMTPSecure = $default_provider->get_secure();
$phpmailer->Port = $default_provider->get_port();
$phpmailer->SMTPAuth = $default_provider->is_authentication();
$phpmailer->SMTPDebug = SMTP::DEBUG_LOWLEVEL;
// Authentication if required
if ($phpmailer->SMTPAuth) {
$phpmailer->Username = $default_provider->get_username();
$phpmailer->Password = $default_provider->get_password();
}
}, 99999);This version directly instantiates the repository object and doesn’t rely on
$this
. The functionality remains the same, but it’s now structured to work within WordPress’s function scope. Please let me know if you encounter any issues with this implementation.
Best Regards,
HoangHi @ptaubman ,
Could you please check your Solid Mail email logs (Dashboard > Solid Mail > Mail Logs) for any error messages? This will help us identify and resolve the connection issue you’re experiencing.
If you spot any errors, please share them with us.
Looking forward to helping you get this resolved quickly.
Best regards,
HoangHi,
To customize the “From” email address and name for all outgoing emails, you can add the following code snippet to your theme’s functions.php file or in a site-specific plugin:add_action( 'phpmailer_init', function ( $phpmailer ) {
$phpmailer->From = '[email protected]';
$phpmailer->FromName = 'Your Name';
}, 99999 );If you need any clarification or run into any issues while implementing this solution, please don’t hesitate to reach out again.
Best Regards,
Hoang
Thank you for providing that information about the Contact Form 7 issue. You mentioned a screenshot, but I’m not able to see it in your message. Could you please try uploading the screenshot again? It would be very helpful to see the form configuration you’re referring to.
Hi there,
Thank you for bringing this to our attention! I’m currently trying to replicate the issue on my end. Just to clarify, when you mention “checkout,” are you referring to WooCommerce or another plugin? This will help me better understand the context and resolve the issue as quickly as possible.
I’ll keep you updated on the progress!
Best regards,
Thank you for the update, and I’m sorry to hear that Solid Mail didn’t work as expected after your migration. I completely understand your decision to switch plugins, and I appreciate you giving Solid Mail a try.
If you ever decide to revisit Solid Mail or need assistance with anything else, feel free to reach out—we’re always here to help.
Thank you for reaching out! It sounds like it could be a caching issue, especially after the migration. Could you please try doing a hard refresh (Ctrl+F5 or Command+Shift+R) on your browser? This should clear the cache and might resolve the issue. If that doesn’t work, let us know and we’ll look into it further!
Thank you! We’re glad the plugin is working well for you. Moving the ‘Delete’ button to the top is a great suggestion, and we’ll look into making that change. We’re also excited to share that a bulk delete option for mail logs will be released very soon!
If you have any other questions don’t hesitate to reach back out. We are here and happy to help!