2023-04-13 17:39:50 +02:00
|
|
|
<?php
|
|
|
|
class Mail {
|
|
|
|
public $from;
|
|
|
|
public $to;
|
|
|
|
public $subject;
|
|
|
|
public $message;
|
|
|
|
public $headers;
|
|
|
|
|
|
|
|
function __construct($from, $to, $subject, $message, $headers=null) {
|
|
|
|
$this->from = $from;
|
|
|
|
$this->to = $to;
|
|
|
|
$this->subject = $subject;
|
|
|
|
$this->headers = $headers;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function send() {
|
|
|
|
// odeslání e-mailu
|
|
|
|
$headers = 'From: noreply@fofrweb.com' . "\r\n" .
|
|
|
|
'Reply-To: support@fofrweb.com' . "\r\n" .
|
|
|
|
'X-Mailer: PHP/' . phpversion();
|
|
|
|
$this->headers = $headers;
|
|
|
|
|
|
|
|
if (gettype($this->message) == 'string') {
|
|
|
|
if(mail($this->to, $this->subject, $this->message, $this->headers)) {
|
2023-04-16 12:32:07 +02:00
|
|
|
return true;
|
2023-04-13 17:39:50 +02:00
|
|
|
} else {
|
2023-04-16 12:32:07 +02:00
|
|
|
return false;
|
2023-04-13 17:39:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|