Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate MailPoet #82

Open
nate-allen opened this issue Feb 24, 2023 · 3 comments
Open

Investigate MailPoet #82

nate-allen opened this issue Feb 24, 2023 · 3 comments

Comments

@nate-allen
Copy link
Contributor

It looks like MailPoet can be setup to send emails without using wp_mail. Look into how it does send email, and if we can disable that feature. If not, we may need to add the plugin to the deny list.

@NickGreen
Copy link
Contributor

Adding plugin to the denylist in the short term. If this issue turns up a better solution, feel free to remove it as needed.

@gin0115
Copy link
Collaborator

gin0115 commented Jun 26, 2023

The mailer options are saved in the {prefix_}mailpoet_settings table.


You can force the mailer to use PHP by setting

  • smtp_provider = server.
  • mta you need to set the method value as PHPMail
a:14:{s:22:"mailpoet_api_key_state";a:3:{s:18:"access_restriction";s:0:"";s:4:"data";a:1:{s:11:"is_approved";s:5:"false";}s:5:"state";s:11:"check_error";}s:14:"authentication";s:1:"1";s:10:"encryption";s:0:"";s:8:"password";s:3:"pgq";s:5:"login";s:2:"gq";s:7:"api_key";s:0:"";s:10:"secret_key";s:0:"";s:10:"access_key";s:0:"";s:6:"region";s:9:"us-east-1";s:4:"port";s:4:"2424";s:4:"host";s:14:"smtp.null.void";s:16:"mailpoet_api_key";s:0:"";s:9:"frequency";a:2:{s:8:"interval";s:1:"5";s:6:"emails";s:2:"25";}s:6:"method";s:7:"PHPMail";}

...

Array
(
    [mailpoet_api_key_state] => Array
        (
            [access_restriction] => 
            [data] => Array
                (
                    [is_approved] => false
                )

            [state] => check_error
        )

    [authentication] => 1
    [encryption] => 
    [password] => pgq
    [login] => gq
    [api_key] => 
    [secret_key] => 
    [access_key] => 
    [region] => us-east-1
    [port] => 2424
    [host] => smtp.null.void
    [mailpoet_api_key] => 
    [frequency] => Array
        (
            [interval] => 5
            [emails] => 25
        )

    [method] => PHPMail
)
  • Setting the method as PHPMail is the only change needed.

There is another DB key called web_host, this can be set to manual (probably no needed)


Or you can set fake SMTP using

  • smtp_provider = manual
  • mta you will need to update
    • host as some fake host
    • port as some fake port
    • login as some fake username
    • password as some fake password
    • method as SMTP
a:14:{s:22:"mailpoet_api_key_state";a:3:{s:18:"access_restriction";s:0:"";s:4:"data";a:1:{s:11:"is_approved";s:5:"false";}s:5:"state";s:11:"check_error";}s:14:"authentication";s:1:"1";s:10:"encryption";s:0:"";s:8:"password";s:3:"pgq";s:5:"login";s:2:"gq";s:7:"api_key";s:0:"";s:10:"secret_key";s:0:"";s:10:"access_key";s:0:"";s:6:"region";s:9:"us-east-1";s:4:"port";s:4:"2424";s:4:"host";s:14:"smtp.null.void";s:16:"mailpoet_api_key";s:0:"";s:9:"frequency";a:2:{s:8:"interval";s:1:"5";s:6:"emails";s:2:"25";}s:6:"method";s:4:"SMTP";}

...

Array
(
    [mailpoet_api_key_state] => Array
        (
            [access_restriction] => 
            [data] => Array
                (
                    [is_approved] => false
                )

            [state] => check_error
        )

    [authentication] => 1
    [encryption] => 
    [password] => pgq        <<==
    [login] => gq            <<==
    [api_key] => 
    [secret_key] => 
    [access_key] => 
    [region] => us-east-1
    [port] => 2424           <<==
    [host] => smtp.null.void <<==
    [mailpoet_api_key] => 
    [frequency] => Array
        (
            [interval] => 5
            [emails] => 25
        )

    [method] => SMTP <<==
)

@BrianHenryIE
Copy link

BrianHenryIE commented Feb 8, 2024

I wasn't aware of that hook solution.

I approached a similar problem by loading the PHPMailer class early and replacing it with a subclass of my own where I overrode the send method.

https://github.com/BrianHenryIE/bh-wp-one-click-list-unsubscribe-mailto-header/blob/50fbdf36ae028d0d09e8849ef9ffd0da170980bf/src/Integrations/class-mailpoet.php#L50

https://github.com/BrianHenryIE/bh-wp-one-click-list-unsubscribe-mailto-header/blob/50fbdf36ae028d0d09e8849ef9ffd0da170980bf/src/API/class-phpmailer-intercept.php#L7

Didn't really test it much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants