Quote from: sottwell at Oct 03, 2008, 01:46 AM
And if you need to send mail using SMTP instead of mail()?
Just call...
<?php
$modx->mail->set(MODX_MAIL_ENGINE, 'smtp');
?> ...and then you can set any of the other smtp constants that need to be set. Here’s the SMTP related constants defined in the modMail class.
<?php
define('MODX_MAIL_SMTP_AUTH', 'mail_smtp_auth');
define('MODX_MAIL_SMTP_HELO', 'mail_smtp_helo');
define('MODX_MAIL_SMTP_HOSTS', 'mail_smtp_hosts');
define('MODX_MAIL_SMTP_KEEPALIVE', 'mail_smtp_keepalive');
define('MODX_MAIL_SMTP_PASS', 'mail_smtp_pass');
define('MODX_MAIL_SMTP_PORT', 'mail_smtp_port');
define('MODX_MAIL_SMTP_PREFIX', 'mail_smtp_prefix');
define('MODX_MAIL_SMTP_SINGLE_TO', 'mail_smtp_single_to');
define('MODX_MAIL_SMTP_TIMEOUT', 'mail_smtp_timeout');
define('MODX_MAIL_SMTP_USER', 'mail_smtp_user');
?>
You can also pass in all these attributes when you create the mail service instance...
<?php
$modx->getService('mail', 'mail.modPHPMailer', array(
MODX_MAIL_SMTP_USER => 'mailuser',
MODX_MAIL_SMTP_PASS => 'mailpassword'
));
?>
Before beta, I will be adding system settings (defined during setup) for all of these options to be automatically passed in as default attributes for a deployment whenever you call the mail service, but for now, that’s how you can set that manually.