hello evryone,
I have created a script in php for reading information from mysql and then sending in to the subscribers. Everything works fine and when the subscriber opens an email in outlook exrpess or any other soft or webmail that doesnt format the html code of the email its still ok but when an email is opened in webmail like yahoo or msn everything is messed up all the tables and the text is shifted. I`ve spent a week already on this and cant fix that.
This part of my script:
function subskrypcja_send(){
global $PHAPP,$APP_DIR;
$tab1 = $PHAPP->getDBTable("subskrypcja_def.php");
$tab2 = $PHAPP->getDBTable("subskrypcja_lista.php");
$tabu = $PHAPP->getDBTable("ustawienia.php");
$tabuser = $PHAPP->getDBTable("user_www.php");
$tab_sql = array();
$subs_sql = array();
$subs_def = $tab1->select("");
foreach($subs_def as $val){
$t_nazwa = $val->tabela; //holds value of column tabela from table subskrybcja_def : could be wiadomosc or ogloszenie
if($tab_sql[$t_nazwa]==""){
$tab_sql[$t_nazwa] = $PHAPP->getDBTable($t_nazwa.".php");
}//end if
}//end foreach
//
$ost = $tabu->select("","nazwa='last_subs'");
if(count($ost)==0){
print "BRAK wpisu - blad krytyczny - prosze to zglosic administratorowi";
exit();
}//end if
$last = $ost[0]->wartosc; // id | nazwa | wartosc z tabeli ustawienia.php
$last_id = $ost[0]->id;
$dzis = date("Y-m-d");
if($last==""){
$last_alt = mktime (0,0,0,date("m"),date("d")-10, date("Y"));
$last = date ("Y-m-d", mktime (0,0,0,date("m"),date("d")-10,date("Y")));
}
//sub
foreach($subs_def as $val){
$tabela = $val->tabela; //holds value of column tabela from table subskrybcja_def wiadomosc or ogloszenie
$warunek = $val->warunek;//holds value of column warunek from table subskrybcja_def wpisywane w kontent mngmnt
$czas = $val->czas;//holds value of column czas from table subskrybcja_def : kiedy or data
$nazwa = $val->nazwa; //holds j.w , nazwa dzialu : Wiad ze Sw, Wiad z Pol, Wiad z USA
$expir = $val->expir;
$id = $val->id; //holds j.w id nazwy dzialu
if($warunek!=""){
$warunek .= " AND $czas>'$last'";
}
else{
$warunek .= "$czas>'$last'";
}
if(trim($expir)!=""){
if($warunek!=""){
$warunek .= " AND $expir>'$dzis'";
}
else{
$warunek .= "$expir>'$dzis'";
}
}
$tytul = $val->tytul; //NAME of the column TYTUL from table wiadomosc
$body = $val->body; //NAME of the column TRESC from table wiadomosc?
$pola = "$tytul,$body"; //$pola holds string 'tytul,tresc'
//here string $tabela ma wartosc 'wiadomosc'
$wynik = $tab_sql[$tabela]->select("$pola","$warunek");//select tytul,tresc from wiadomosc or ogloszenie where $warunek
$ar_tytul = explode(",",$tytul);
$ar_tresc = explode(",",$body);
///////////
if(count($wynik)>0){
$tmp_form = '';
foreach($wynik as $val1){
foreach($ar_tytul as $val2){
$tmp_form.=''."<tr><td><div style='position:relative;top:13;left:24;z-index:1;font-family:Arial,Verdana,Tahoma;font-size:11px;color:#330099;font-weight:bold;'>";
//TUTAJ EW NAGLOWEK Z POL I BODY TEZ Z POL
if($val1->$val2!=""){
$tmp_form .= " ".trim($val1->$val2)."</div><div style='position:relative;top:0;left:12;z-index:-1;'><img src='http://image-source.com/templates/subskrybcja/sub_pl/images/sub_07.jpg' ></div></td></tr></table>";
}//end if
$tmp_form .='';
}//end foreach z $ar_tytul
if (trim($tmp_form)!="")
$tmp_form .= "\n";
foreach($ar_tresc as $val2){
//TUTAJ EW NAGLOWEK Z POL I BODY TEZ Z POL
if($val1->$val2!=""){
$tmp_form .= "<div style='position:relative;top:0;left:12;z-index:-1;font-family:Arial,Verdana,Tahoma;font-size:11px;color:#330099;font-weight:normal;width:600px;'>".trim($val1->$val2)."</div>";
}
$tmp_form .="<div style='position:relative;top:0;left:555;z-index:-1;'><img src='http://image-source.com/templates/subskrybcja/sub_pl/images/sub_13.jpg' height='15'></div><div style='position:relative;top:0;left:566px;top:-15px;z-index:-0;font-family:Arial,Verdana,Tahoma;font-size:10px;color:#330099;font-weight:800;'><a style='text-decoration:none;' href='http://www.image-source.com' target=new>więcej</a></div>" ;
//<img src='http://www.image-source.com/templates/subskrybcja/sub_pl/images/sub_14.jpg' width='545' height='15' >
}//end foreach z $ar_tresc
if (trim($tmp_form)!="")
$tmp_form .= "\n";
}
//formatowanie typu wiadomosci i storing w tabeli (tylko typ wiadomosci)
$gornylejer="<div style='position:relative;top:18;left:12;z-index:1;font-family:Arial,Verdana,Tahoma;font-size:11px;color:#330099;font-weight:800;'>";
$dolnylejer="</div><div style='position:relative;top:0;left:0;z-index:-1;'><img src='http://image-source.com/templates/subskrybcja/sub_pl/images/sub_03.jpg' width='150' height='25' alt=''><img style='position:absolute;left:150px' src='http://image-source.com/templates/subskrybcja/sub_pl/images/sub_02.jpg' width='467' height='25' alt=''></div>";
$subs_sql[$id][nazwa] = $gornylejer.$nazwa.$dolnylejer; //tu nazwa ma Wiad ze swiata lub wiad z Pol itd
//storing w tabeli tresci calej subskrybcji (tylko tresci)
$subs_sql[$id][wartosc] = $tmp_form; //tu forma$ nie ma jeszcze Wiad ze swiata itd
}
}
I know it can be messy and its not the entire script but if someone is willing to help me i could provide the entire script for him.