mysql - PHP Cron Script - read from from CSV file and email (UTF-8?) -


i struggling issue few days now, reading , trying whatever came across no solution found: here bottom line of want do: have members system. when member posts message on message board others notification email. simple. use php script create list of recipients (email , name) in csv file, store file opened later cron job , shoot emails out. simple. oh ... names in hebrew script stored in mysql db. have tried script manually (running through browser , went sweet). running through cron, though, not read names , leave blank:

while($arrmailattrib = fgetcsv($hfile)) {     $saptname   = $arrmailattrib[0];     $saptnum    = $arrmailattrib[1];     $sto        = $arrmailattrib[2];     $ssubject   = $arrmailattrib[3];     $smsgurl    = $arrmailattrib[4];     $sbody      = "<span style=\"font-family: arial, helvetica, sans-serif; direction: rtl !important; vertical-align: right; display: block;\" lang=\"he\" dir=\"rtl\"> <p>שלום $saptname (מספר חבר $saptnum),</p> <p>הודעה חדשה בנושא '$ssubject' נוצרה בלוח המודעות הוירטואלי.</p> <p>על מנת לצפות בהודעה ישירות במערכת <a href=\"$smsgurl\">כאן</a></p> <p>על מנת להכנס למערכת  הכנס ל: <a href=\"http://www.somesite.com\">http://www.somesite.com</a> </p> <p><font size=\"-1\" color=\"#999999\">זוהי הודעת אימייל אוטומטית. נא לא להגיב לכתובת אימייל זו.</font></p> <p>&nbsp;</p> </span>";     if(defined('_debug_')) {fputs($hlogfile, "sending email subject '$ssubject' $sto\n");}     mail($sto, $ssubject, $sbody, $sheaders); } 

the csv being created names , email straight brought db. positive has encoding - seem not able put finger on exactly. here few lines csv file: שמואלי,

1,בהיר,someone1@gmail.com,הודעה נסיונית,http://www.somesite.com/_new.message_present.php?fldmsg=111     כהן,2,someone2@gmail.com,הודעה נסיונית,http://vwww.somesite.com/_new.message_present.php?fldmsg=112     שפיר,4,someone3@hotmail.com,הודעה נסיונית,http://www.somesite.com/_new.message_present.php?fldmsg=113     ליבוביץ,5,someone4@metis.asia,הודעה נסיונית,http://www.somesite.com/_new.message_present.php?fldmsg=114 

one more thing worth noteing error email cron job text: "content-type:text/html"

by way - emails fine recipients, body of email show in hebrew. things missing subject , name.

anyone ...?

may encoding issue try : open .csv file in notepad, choose -> save as..and @ bottom of "save as" box, there select box labelled "encoding". select utf-8. after selecting utf-8, choose select type under "save type" save file different file name original.

you have add line php code : header("content-type: text/html; charset=utf-16le");

could tell msg error :) how characters displayed ?


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -