email sending added in paymentok
This commit is contained in:
parent
e81637b608
commit
b9408d6c71
@ -888,6 +888,49 @@ if ($ispaymentok) {
|
|||||||
setEventMessages(null, $attendeetovalidate->errors, "errors");
|
setEventMessages(null, $attendeetovalidate->errors, "errors");
|
||||||
} else {
|
} else {
|
||||||
$attendeetovalidate->setStatut(1);
|
$attendeetovalidate->setStatut(1);
|
||||||
|
|
||||||
|
// Sending mail
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||||
|
$formmail = new FormMail($db);
|
||||||
|
// Set output language
|
||||||
|
$outputlangs = new Translate('', $conf);
|
||||||
|
$outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
|
||||||
|
// Load traductions files required by page
|
||||||
|
$outputlangs->loadLangs(array("main", "members"));
|
||||||
|
// Get email content from template
|
||||||
|
$arraydefaultmessage = null;
|
||||||
|
|
||||||
|
$labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT;
|
||||||
|
if (!empty($labeltouse)) {
|
||||||
|
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
|
||||||
|
$subject = $arraydefaultmessage->topic;
|
||||||
|
$msg = $arraydefaultmessage->content;
|
||||||
|
}
|
||||||
|
|
||||||
|
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty);
|
||||||
|
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||||
|
|
||||||
|
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
|
||||||
|
$texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
|
||||||
|
|
||||||
|
$sendto = $thirdparty->email;
|
||||||
|
$from = $conf->global->MAILING_EMAIL_FROM;
|
||||||
|
$urlback = $_SERVER["REQUEST_URI"];
|
||||||
|
|
||||||
|
$ishtml = dol_textishtml($texttosend); // May contain urls
|
||||||
|
|
||||||
|
$mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml);
|
||||||
|
|
||||||
|
$result = $mailfile->sendfile();
|
||||||
|
if ($result) {
|
||||||
|
dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment');
|
||||||
|
} else {
|
||||||
|
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user