odstranjevanje headerjev iz email sporočila
 
php.programer 9. jul 2014 19:02:21 Pridružen od:
20. sep 2011
347 objav
154 106 10
#1

--047d7b343cf6a739b804fdc72eef Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable testiranje spletnih aplikacij je lahko tudi zelo u=C4=8Dinkovito :) --=20 Lep pozdrav, Oseba XY --047d7b343cf6a739b804fdc72eef Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

vsebina email sporocila se zacne s to vrstico <-- ZACETEK SPOROCILA

fusbalsvetovnoprvenstvojekul

vsebina email sporocila se konca s to vrstico <-- KONEC SPOROCILA



--047d7b343cf6a739b804fdc72eef--



zgoraj sem prilepil primer kode, ko iz serverja preberem email sporocilo. rad bi izlocil tisto kar je generirano nepotrebno - headerje in tisti del v footerju. any idea, obstaja kaka funkcija?


všeč(0) ni všeč(1) spam(0)
 
php.programer 10. jul 2014 17:26:49 Pridružen od:
20. sep 2011
347 objav
154 106 10
#2

Kaj res ne ve nihče, kako se headerji iz mejlov odstranijo? .... sem poizkušal na več načinov, pa ni neke idealne rešitve. Any Idea?


všeč(0) ni všeč(0) spam(0)
 
OvcaX 10. jul 2014 17:52:01 Pridružen od:
24. avg 2007
2753 objav
4575 1194 281
#3

Kako pa prebereš mail?

Imaš samo txt ali preko imapa/pop?*


všeč(0) ni všeč(0) spam(0)
CEO@Humanfrog & CEO@Junai
 
php.programer 10. jul 2014 18:26:22 Pridružen od:
20. sep 2011
347 objav
154 106 10
#4

ovcax s tem spodaj preberem mejle s serverja.



<?php

class Emailreader {

public $conn;

private $inbox;

private $msg
cnt;

private $server = 'mail.domena.com';

private $user = 'email@domena.com';

private $pass = '123456';

private $port = 587; // adjust according to server settings


function __construct() {
$this->connect();
$this->inbox();
}
function close() {
$this->inbox = array();
$this->msg_cnt = 0;
imap_errors();
imap_alerts();
imap_close($this->conn);
}

function connect() {
$this->conn = imap_open('{'.$this->server.'/notls}', $this->user, $this->pass);
}

function move($msg_index, $folder='INBOX.Processed') {

imap_mail_move($this->conn, $msg_index, $folder);
imap_expunge($this->conn);
$this->inbox();
}

function get($msg_index=NULL) {
if (count($this->inbox) <= 0) {
return array();
}
elseif ( ! is_null($msg_index) && isset($this->inbox[$msg_index])) {
return $this->inbox[$msg_index];
}
return $this->inbox[0];
}
function inbox() {
$this->msg_cnt = imap_num_msg($this->conn);
$in = array();
for($i = 1; $i <= $this->msg_cnt; $i++) {
$in[] = array(
'index' => $i,
'header' => imap_headerinfo($this->conn, $i),
'body' => imap_body($this->conn, $i),
'structure' => imap_fetchstructure($this->conn, $i)
);
}
$this->inbox = $in;
return $in;
}

}

?>


všeč(0) ni všeč(0) spam(0)
 
sikmajnd 10. jul 2014 18:30:55 Pridružen od:
11. nov 2013
89 objav
156 9 1
#5

Mogoče ti bo tole prišlo prav: Plancake email parser


všeč(0) ni všeč(0) spam(0)
 
 

🔒 Za odgovor na to temo se moraš prijaviti.

Prijavi se