[Plugin: WP Mail SMTP] Running mail in production server, and SMTP in localhost
-
I wanted to share this little piece of code with you.
add_filter( 'option_mailer', 'childtheme_option_mailer' ); function childtheme_option_mailer( $value ) { if ( 'localhost' == $_SERVER['HTTP_HOST'] ) { return 'smtp'; } else { return 'mail'; } }
change ‘localhost’ to whatever your host name is locally,
this will override the option value set in the settings page, and it will send mails using mail() in your production server, and will use smtp when developing locally (comes in handy if you develop on windows)
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘[Plugin: WP Mail SMTP] Running mail in production server, and SMTP in localhost’ is closed to new replies.