• Resolved bijibuji

    (@bijibuji)


    I used phpmailer_init action to send emails through gmail smtp server. but it sounds like email users does not work with it.

    would you please let me know if email users is intended to just work with wp_mail() or not? can I get it to work with phpmailer , gmail SMPT server?

    https://ww.wp.xz.cn/plugins/email-users/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Mike Walsh

    (@mpwalsh8)

    As long as your phpmailer_init hook is implemented properly there is no reason why it shouldn’t work. Have you tired it? I personally have used other SMTP plugins which hook into wp_mail() without any issues.

    Thread Starter bijibuji

    (@bijibuji)

    Thanks for your answer.

    This is how I implemented the hook:

    function my_phpmailer_init( $PHPMailer ){
    	$PHPMailer->IsSMTP();
    	$PHPMailer->SMTPAuth = true;
    	$PHPMailer->SMTPSecure = 'ssl';
    	$PHPMailer->Host = 'smtp.gmail.com';
    	$PHPMailer->Port = 465;
    	$PHPMailer->Username = '[email protected]';
    	$PHPMailer->Password = 'my_gmail_password';
    }
    add_action( 'phpmailer_init', 'my_phpmailer_init' );

    Are there any step by step guides or something to correctly implement Email Users plugin in wordpress?

    Thread Starter bijibuji

    (@bijibuji)

    I am getting this notice upon enabling wordpress DEBUG mode
    Notice: Undefined variable: from_sender in C:\wamp\www\mysite\wp-content\plugins\email-users\email_users_send_test_mail.php on line 56

    Undefined variable: from_sender

    WordPress uses the default email address of wordpress@yourdomain if there is no From Header pass to wp_mail in the headers parameter.

    I used phpmailer_init action to send emails through gmail smtp server. but it sounds like email users does not work with it.

    I’m curious how you made this conclusion? The only response returned from wp_mail is true (success) or false (failed). Email Users has no way to give you feedback on the code you’ve included.

    My guess is your code is working, but Google is rejecting your authentication attempt, or perhaps the path to smtp.gmail.com:465 is blocked. I suggest you use an SMTP Plugin to accomplish what you’re attempting : Postman SMTP

    Plugin Author Mike Walsh

    (@mpwalsh8)

    While I also recommend using a SMTP plugin to do what you’re doing, in theory there shouldn’t be any reason why what you’re doing wouldn’t also work.

    In looking at the source code of the error you reported above, there may be a bug. Did you use the “Send Test Notification” button on the Email Users Settings page to produce the error?

    I also suggest trying to use the standard “Send to User” function to send a test email.

    in theory there shouldn’t be any reason why what you’re doing wouldn’t also work.

    In theory, yes. But in practice, there’s a few reasons.

    For example, what if Google disabled his password auth and is requiring OAuth 2.0? Then his attempt to send a password won’t work.

    What if his host is blocking his access to Gmail? Then his attempt to use SMTP over port 465 won’t work.

    but it sounds like email users does not work with it.

    I’m only guessing, since he hasn’t said what the actual issue is, if there is one.

    Plugin Author Mike Walsh

    (@mpwalsh8)

    I did some testing with the phpmailer_init hook (which is from this article) on my own site. The code as written above works on my wite using my Google Gmail credentials with one exception.

    The “Test Notification Email” feature on the plugin settings page (Dashboard > Settings > Email Users) does not work in 4.7.8 due to the error reported above. My guess is the error has been there a while as the change that introduced it was made some time ago.

    The Email Users “Send to User(s)” and “Send to Group(s)” will work correctly using the phpmailer_init hook – at least it does for me. As the post above notes, the ability to use Google for SMTP can change and if you turn on two factor authentication or app specific passwords, you will likely have more work to do.

    This will be true whether using the hook above or a SMTP email plugin.

    In the end, this thread highlighted a bug which I have noe fixed in v4.7.9 which I pushed out this morning. Install the update the Test Notification email should work with your phpmailer_init hook code.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘phpmailer and gmail smtp server’ is closed to new replies.