kopia lustrzana https://github.com/newroco/mail2deck
37 wiersze
987 B
PHP
37 wiersze
987 B
PHP
![]() |
<?php
|
||
|
|
||
|
class MailClass {
|
||
|
private $inbox;
|
||
|
|
||
|
public function __construct()
|
||
|
{
|
||
|
$this->inbox = imap_open("{" . MAIL_SERVER . ":" . MAIL_SERVER_PORT . MAIL_SERVER_FLAGS . "}INBOX", MAIL_USER, MAIL_PASSWORD)
|
||
|
or die("can't connect:" . imap_last_error());
|
||
|
}
|
||
|
|
||
|
public function __destruct()
|
||
|
{
|
||
|
imap_close($this->inbox);
|
||
|
}
|
||
|
|
||
|
public function getNewMessages() {
|
||
|
return imap_search($this->inbox, 'UNSEEN');
|
||
|
}
|
||
|
|
||
|
public function fetchMessageStructure($email) {
|
||
|
return imap_fetchstructure($this->inbox, $email);
|
||
|
}
|
||
|
|
||
|
public function fetchMessageBody($email, $section) {
|
||
|
return imap_fetchbody($this->inbox, $email, $section);
|
||
|
}
|
||
|
|
||
|
public function headerInfo($email) {
|
||
|
return imap_headerinfo($this->inbox, $email);
|
||
|
}
|
||
|
|
||
|
public function reply($sender, $response) {
|
||
|
$to = $sender->mailbox . '@' . $sender->host;
|
||
|
mail($to, 'your card has been created', 'card/board link.....');
|
||
|
}
|
||
|
}
|