Files
fdn2/private/lib/dao/models/MailModel.php
T
Riccardo Di Dato 1718518fe5 Aggiunte a config le mail di sistema
Aggiunti nuovi task per mail server
Creato metodo in guihandler per aprire le pagine con richiesta post
Aggiunta possibilità di passare callback ai backend delle datatables
Modificati alcuni url
Modificato HTMLInclusion per non utilizzare i path assoluti in fase di
creazione ma solo in fase di stampa degli header (per evitare problemi
sugli script)
Creato mailserver e mail template
Creata interfaccia mail per salvataggio mail in database, gestione coda.
Creata interfaccia grafica per la gestione delle mail  e delle code
Incluse librerie PHP_Mailer
Inserite pagine di creazione e cancellazione manuale utenti

Bugfix su alcune pagine di edit
2016-01-25 18:23:28 +01:00

75 lines
1.5 KiB
PHP

<?php
/*
Author: Riccardo Di Dato
Creation Date: 25/gen/2016
*/
class MailModel extends Model implements FDN_MailInterface{
const STATUS_PENDING = 0;
const STATUS_SENT = 1;
const STATUS_PAUSED = 2;
const PRIORITY_HIGH = 100;
const PRIORITY_NORMAL = 50;
const PRIORITY_LOW = 10;
public function __construct($saveableObject = null){
parent::__construct($saveableObject);
$requiredProps = array("from","subject","body","recipient");
if (!$this->hasProperty("status")){
$this->status = self::STATUS_PENDING;
}
if (!$this->hasProperty("priority")){
$this->priority = self::PRIORITY_NORMAL;
}
foreach ($requiredProps as $prop){
if (!$this->hasProperty($prop)){
throw new CoreException("Missing parameter '$prop' while calling MailModel::__construct()");
}
}
}
public function getMailObject(){
$email = new PHPMailer();
$email->CharSet = "UTF-8";
$email->isMail();
$email->From = $this->from;
if ($this->hasProperty("fromName")){
$email->FromName = $this->fromName;
}
$email->Subject = $this->subject;
$email->IsHTML(true);
$email->Body = $this->body;
if ($this->hasProperty("altBody")){
$email->AltBody = $this->altBody;
}
else {
$email->AltBody = strip_tags($this->body);
}
$email->AddAddress($this->recipient);
if ($this->hasProperty("attachment")){
$email->AddAttachment( $this->attachment , basename($this->attachment) );
}
return $email;
}
public static function getCollectionName(){
return "mail";
}
}
?>