Hi i’m trying to send an email with mail.modPHPMailer
( $modx->getService('mail', 'mail.modPHPMailer');
) it does not work and i’m getting an error in the log files saying:
An error occurred while trying to send the email: Invalid address: (punyEncode)
This is with a snippet that used to work fine. but since i updated to MODX 2.8.1 i get this error.
i checked the email adress and that is correct. Any idea what is going wrong?
RDG
I assume the error occurs here in the code.
}
// Validate From, Sender, and ConfirmReadingTo addresses
foreach (array('From', 'Sender', 'ConfirmReadingTo') as $address_kind) {
$this->$address_kind = trim($this->$address_kind);
if (empty($this->$address_kind)) {
continue;
}
$this->$address_kind = $this->punyencodeAddress($this->$address_kind);
if (!$this->validateAddress($this->$address_kind)) {
$error_message = $this->lang('invalid_address') . ' (punyEncode) ' . $this->$address_kind;
$this->setError($error_message);
$this->edebug($error_message);
if ($this->exceptions) {
throw new phpmailerException($error_message);
}
return false;
}
}
// Set whether the message is multipart/alternative
Are the values for ‘From’, ‘Sender’ and ‘ConfirmReadingTo’ all a valid email-address or empty?
Hi,
no there is no ConfirmReadingTo
no idea what that is?
Any idea how i should add this?
right now i have:
$modx->mail->address('to', $_POST['emailadres']);
$modx->mail->address('reply-to', '[email protected] ');
$modx->mail->set(modMail::MAIL_FROM, '[email protected] ');
$modx->mail->set(modMail::MAIL_FROM_NAME, 'afzender naam');
$modx->mail->set(modMail::MAIL_SENDER, 'Aanmeldformulier');
$modx->mail->set(modMail::MAIL_SUBJECT, $subject);
$modx->mail->set(modMail::MAIL_BODY, $message);
Try setting modMail::MAIL_SENDER
to an email address (or maybe leave it empty).
Hi,
tnx yes that seemed to work. I don’t understand why because the script has always been the otherway and that worked
RDg