I was working with SMTP email with Mailgun recently. It was quite simple when you want to send email using SMTP with your custom domain.
Here's the trick.
1. Create an email in your cPanel (info@your_domain.com)
2. Register with Mailgun service http://mailgun.com, it's free 10.000 email /month.
3. Add your billing CC to enable "Custom Domain". Don't worry, it's still free if you send email under 10.000 email /month. It's lots email thou.
4. After you create custom domain, you can set DNS (MX, CNAME and TXT record) Setting in cPanel to enable send email from your host with Mailgun. See the instruction https://documentation.mailgun.com/en/latest/quickstart-sending.html#add-sending-tracking-dns-records
5. Add this line to couch/addons/kfunctions.php
Here's the example code:
7. Finally send your email using <cms:send_mail></cms:send_mail> and set your preference and email (step 1) as usual method. Good luck!
Here's the trick.
1. Create an email in your cPanel (info@your_domain.com)
2. Register with Mailgun service http://mailgun.com, it's free 10.000 email /month.
3. Add your billing CC to enable "Custom Domain". Don't worry, it's still free if you send email under 10.000 email /month. It's lots email thou.
4. After you create custom domain, you can set DNS (MX, CNAME and TXT record) Setting in cPanel to enable send email from your host with Mailgun. See the instruction https://documentation.mailgun.com/en/latest/quickstart-sending.html#add-sending-tracking-dns-records
5. Add this line to couch/addons/kfunctions.php
- Code: Select all
require_once( K_COUCH_DIR.'addons/phpmailer/phpmailer.php' );
Here's the example code:
- Code: Select all
<?php if ( !defined('K_COUCH_DIR') ) die(); // cannot be loaded directly // 1. Method used for sending emails. // // Four valid options available: // 'smtp' - Send messages using SMTP (e.g. GMail). // 'mail' - Send messages using PHP's mail() function. // 'sendmail' - Send messages using $Sendmail. // 'qmail' - Send messages using qmail. // $cfg['method'] = 'smtp'; // 2. SMTP settings: required only if $cfg['method'] above is set to 'smtp'. $cfg['host'] = 'smtp.mailgun.org'; // Address of the SMTP server. If left empty, defaults to 'localhost'. $cfg['port'] = '587'; // Port of the SMTP server. If left empty, defaults to '25'. $cfg['secure'] = 'tls'; // encryption to use on the SMTP connection. Valid options are '', 'ssl' or 'tls'. $cfg['authentication_required'] = '1'; // set this to '0' if your SMTP server does not require authentication // If 'authentication_required' above is set to '1', the following credentials will be required $cfg['username'] = 'postmaster@your_domain_name'; $cfg['password'] = 'your_password'; // 3. Debug. If set to '1', will log all debug output in 'log.txt' at site's root. $cfg['debug'] = '1';
7. Finally send your email using <cms:send_mail></cms:send_mail> and set your preference and email (step 1) as usual method. Good luck!