Skip to content

Commit e18dfa5

Browse files
authored
Merge pull request #37 from soderlind/wordpress/smtp
How to send email from WordPress to Buggregator
2 parents c514817 + 1ce09a3 commit e18dfa5

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

docs/config/smtp.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,30 @@ or
3838
bin/magento config:set system/smtp/transport smtp
3939
bin/magento config:set system/smtp/host 127.0.0.1
4040
bin/magento config:set system/smtp/port 1025
41-
```
41+
```
42+
43+
## WordPress
44+
45+
Save the following code to a file in the [mu-plugins](https://developer.wordpress.org/advanced-administration/plugins/mu-plugins/) directory (e.g. `smtp.php`):
46+
47+
```php
48+
<?php
49+
/**
50+
* Plugin Name: MU Buggregator SMTP
51+
*/
52+
53+
if (! defined('WP_ENVIRONMENT_TYPE') || 'local' !== WP_ENVIRONMENT_TYPE) {
54+
return;
55+
}
56+
57+
/**
58+
* Send emails to Buggregator
59+
*
60+
* @param \PHPMailer $phpmailer The PHPMailer instance (passed by reference).
61+
*/
62+
add_action( 'phpmailer_init', function( $phpmailer ) : void {
63+
$phpmailer->isSMTP();
64+
$phpmailer->Host = '127.0.0.1';
65+
$phpmailer->Port = 1025;
66+
} );
67+
```

0 commit comments

Comments
 (0)