Index: trunk/extensions/EmailArticle/EmailArticle.i18n.php |
— | — | @@ -0,0 +1,400 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Internationalisation file for extension EmailArticle. |
| 5 | + * |
| 6 | + * @addtogroup Extensions |
| 7 | +*/ |
| 8 | + |
| 9 | +$messages = array(); |
| 10 | + |
| 11 | +/** English |
| 12 | + * @author Nad |
| 13 | + */ |
| 14 | +$messages['en'] = array( |
| 15 | + 'emailarticle' => 'E-mail page', |
| 16 | + 'ea-desc' => 'Send rendered HTML page to an e-mail address or list of addresses using [http://phpmailer.sourceforge.net phpmailer].', |
| 17 | + 'ea-heading' => "=== E-mailing the page [[$1]] ===", |
| 18 | + 'ea-fromgroup' => 'From group:', |
| 19 | + 'ea-articlesend' => 'Page "$1" sent from $2', |
| 20 | + 'ea-noarticle' => "Please specify a page to send, for example [[Special:EmailArticle/Main Page]].", |
| 21 | + 'ea-norecipients' => "No valid e-mail addresses found!", |
| 22 | + 'ea-listrecipients' => "=== {{PLURAL:$1|Recipient|$1 recipients}} ===", |
| 23 | + 'ea-error' => "'''Error sending [[$1]]:''' ''$2''", |
| 24 | + 'ea-denied' => 'Permission denied', |
| 25 | + 'ea-sent' => "Page [[$1]] sent successfully to '''$2''' {{PLURAL:$2|recipient|recipients}} by [[User:$3|$3]].", |
| 26 | + 'ea-selectrecipients' => 'Select recipients', |
| 27 | + 'ea-compose' => 'Compose content', |
| 28 | + 'ea-selectlist' => "Additional recipients as page titles or e-mail addresses |
| 29 | +*''separate items with , ; * \\n |
| 30 | +*''list can contain templates and parser-functions''", |
| 31 | + 'ea-show' => 'Show recipients', |
| 32 | + 'ea-send' => 'Send!', |
| 33 | + 'ea-subject' => 'Enter a subject line for the e-mail', |
| 34 | + 'ea-header' => 'Prepend content with optional message (wikitext)', |
| 35 | + 'ea-selectcss' => 'Select a CSS stylesheet', |
| 36 | +); |
| 37 | + |
| 38 | +/** Arabic (العربية) |
| 39 | + * @author OsamaK |
| 40 | + * @author Meno25 |
| 41 | + */ |
| 42 | +$messages['ar'] = array( |
| 43 | + 'emailarticle' => 'مراسلة الصفحة', |
| 44 | + 'ea-heading' => '=== مراسلة صفحة [[$1]] ===', |
| 45 | + 'ea-fromgroup' => 'من مجموعة:', |
| 46 | + 'ea-articlesend' => 'الصفحة "$1" أُرسلت من $2', |
| 47 | + 'ea-norecipients' => 'لا عناوين بريد إلكتروني صحيحة وُجدت!', |
| 48 | + 'ea-error' => "'''خطأ في إرسال [[$1]]:''' ''$2''", |
| 49 | + 'ea-denied' => 'السماح مرفوض', |
| 50 | + 'ea-selectrecipients' => 'اختر المتلقين', |
| 51 | + 'ea-compose' => 'كتابة المحتوى', |
| 52 | + 'ea-send' => 'أرسل!', |
| 53 | + 'ea-subject' => 'أدخل سطر عنوان للبريد الإلكتروني', |
| 54 | +); |
| 55 | + |
| 56 | +/** Bulgarian (Български) |
| 57 | + * @author DCLXVI |
| 58 | + */ |
| 59 | +$messages['bg'] = array( |
| 60 | + 'ea-fromgroup' => 'От група:', |
| 61 | + 'ea-noarticle' => 'Необходимо е да се посочи страница, която да бъде изпратена, напр. [[Special:EmailArticle/Начална страница]].', |
| 62 | + 'ea-norecipients' => 'Не бяха намерени валидни адреси за е-поща!', |
| 63 | + 'ea-listrecipients' => '=== Списък на $1 {{PLURAL:$1|получател|получателя}} ===', |
| 64 | + 'ea-error' => "'''Грешка при изпращане на [[$1]]:''' ''$2''", |
| 65 | + 'ea-selectrecipients' => 'Избиране на получатели', |
| 66 | + 'ea-show' => 'Показване на получателите', |
| 67 | + 'ea-send' => 'Изпращане!', |
| 68 | + 'ea-selectcss' => 'Избиране на CSS стил', |
| 69 | +); |
| 70 | + |
| 71 | +/** Esperanto (Esperanto) |
| 72 | + * @author Yekrats |
| 73 | + */ |
| 74 | +$messages['eo'] = array( |
| 75 | + 'emailarticle' => 'Retpoŝtigi paĝon', |
| 76 | + 'ea-heading' => '=== Retpoŝtigante paĝon [[$1]] ===', |
| 77 | + 'ea-fromgroup' => 'De grupo:', |
| 78 | + 'ea-articlesend' => 'Paĝo "$1" sendita de $2', |
| 79 | + 'ea-noarticle' => 'Bonvolu enigi paĝon por retsendi, ekz-e [[Special:EmailArticle/Main Page]].', |
| 80 | + 'ea-norecipients' => 'Neniaj validaj retadresoj trovitaj!', |
| 81 | + 'ea-listrecipients' => '=== Listo de $1 {{PLURAL:$1|ricevonto|ricevontoj}} ===', |
| 82 | + 'ea-error' => "'''Eraro sendante [[$1]]:''' ''$2''", |
| 83 | + 'ea-denied' => 'Malpermesite', |
| 84 | + 'ea-sent' => "Paĝo [[$1]] sendita sukcese al '''$2''' {{PLURAL:$2|ricevonto|ricevontoj}} de [[User:$3|$3]].", |
| 85 | + 'ea-selectrecipients' => 'Selektu ricevontojn', |
| 86 | + 'ea-compose' => 'Skribu enhavon', |
| 87 | + 'ea-send' => 'Sendi!', |
| 88 | + 'ea-selectcss' => 'Selekti CSS-tiparŝablono', |
| 89 | +); |
| 90 | + |
| 91 | +/** French (Français) |
| 92 | + * @author Grondin |
| 93 | + */ |
| 94 | +$messages['fr'] = array( |
| 95 | + 'emailarticle' => 'Envoyer l’article par courriel', |
| 96 | + 'ea-desc' => 'Envoie le rendu d’une page HTML à une adresse électronique où à une liste d’adresses en utilisant [http://phpmailer.sourceforge.net phpmailer]', |
| 97 | + 'ea-heading' => '=== Envoi de la page [[$1]] par courrier électronique ===', |
| 98 | + 'ea-fromgroup' => 'Depuis le groupe :', |
| 99 | + 'ea-articlesend' => 'Page « $1 » envoyée depuis $2', |
| 100 | + 'ea-noarticle' => 'Veuillez spécifier une page à envoyer, par exemple [[Special:EmailArticle/Accueil]]', |
| 101 | + 'ea-norecipients' => 'Aucune adresse courriel de trouvée !', |
| 102 | + 'ea-listrecipients' => '=== Liste de $1 {{PLURAL:$1|destinataire|destinataires}} ===', |
| 103 | + 'ea-error' => "'''Erreur de l’envoi de [[$1]] :''' ''$2''", |
| 104 | + 'ea-denied' => 'Permission refusée', |
| 105 | + 'ea-sent' => "L'article [[$1]] a été envoyé avec succès à '''$2''' {{PLURAL:$2|destinataire|destinataires}} par [[User:$3|$3]].", |
| 106 | + 'ea-selectrecipients' => 'Sélectionner les destinataires', |
| 107 | + 'ea-compose' => 'Composer le contenu', |
| 108 | + 'ea-selectlist' => "Destinataires supplémentaires comme les titres d'articles ou les adresses courriel |
| 109 | +* ''séparer les articles avec , : * \\n'' |
| 110 | +* ''la liste peut contenir des modèles et des fonctions parseurs''", |
| 111 | + 'ea-show' => 'Visionner les destinataires', |
| 112 | + 'ea-send' => 'Envoyer !', |
| 113 | + 'ea-subject' => 'Entrer une ligne « objet » pour le courriel', |
| 114 | + 'ea-header' => 'Ajouter le contenu au début avec un message facultatif (texte wiki)', |
| 115 | + 'ea-selectcss' => 'Sélectionner une feuille de style CSS', |
| 116 | +); |
| 117 | + |
| 118 | +/** Galician (Galego) |
| 119 | + * @author Toliño |
| 120 | + */ |
| 121 | +$messages['gl'] = array( |
| 122 | + 'emailarticle' => 'Enviar a páxina por correo electrónico', |
| 123 | + 'ea-desc' => 'Enviar páxinas HTML renderizadas a un enderezo de correo electrónico (ou a varios correos) usando [http://phpmailer.sourceforge.net phpmailer].', |
| 124 | + 'ea-heading' => '=== Enviando a páxina "[[$1]]" ===', |
| 125 | + 'ea-fromgroup' => 'Desde o grupo:', |
| 126 | + 'ea-articlesend' => 'O artigo "$1" foi enviado desde $2', |
| 127 | + 'ea-noarticle' => 'Por favor, especifique a páxina que quere enviar, por exemplo: [[Special:EmailArticle/Main Page]].', |
| 128 | + 'ea-norecipients' => 'Non foi atopado ningún enderezo de correo electrónico válido!', |
| 129 | + 'ea-listrecipients' => '=== {{PLURAL:$1|Nome do destinatario|Listaxe dos $1 destinatarios}} ===', |
| 130 | + 'ea-error' => "'''Erro no envío de \"[[\$1]]\":''' ''\$2''", |
| 131 | + 'ea-denied' => 'Permiso denegado', |
| 132 | + 'ea-sent' => 'A páxina "[[$1]]" foi enviada con éxito a \'\'\'$2\'\'\' {{PLURAL:$2|destinatario|destinatarios}} por [[User:$3|$3]].', |
| 133 | + 'ea-selectrecipients' => 'Seleccionar os destinatarios', |
| 134 | + 'ea-compose' => 'Compoñer o contido', |
| 135 | + 'ea-selectlist' => "Destinatarios adicionais como títulos de páxinas ou correos electrónicos |
| 136 | +*''separar os ítems con , ; * \\n |
| 137 | +*''a listaxe`pode conter modelos e funcións analíticas''", |
| 138 | + 'ea-show' => 'Amosar os destinatarios', |
| 139 | + 'ea-send' => 'Enviar!', |
| 140 | + 'ea-subject' => 'Introducir un asunto ao correo electrónico', |
| 141 | + 'ea-header' => 'Engadir o contido cunha mensaxe opcional (texto wiki)', |
| 142 | + 'ea-selectcss' => 'Seleccionar unha folla de estilo CSS', |
| 143 | +); |
| 144 | + |
| 145 | +/** Khmer (ភាសាខ្មែរ) |
| 146 | + * @author Lovekhmer |
| 147 | + */ |
| 148 | +$messages['km'] = array( |
| 149 | + 'emailarticle' => 'ទំព័រអ៊ីមែល', |
| 150 | + 'ea-fromgroup' => 'ពីក្រុម:', |
| 151 | + 'ea-articlesend' => 'ទំព័រ"$1"ត្រូវបានបញ្ជូនពី$2', |
| 152 | + 'ea-send' => 'ផ្ញើ!', |
| 153 | +); |
| 154 | + |
| 155 | +/** Luxembourgish (Lëtzebuergesch) |
| 156 | + * @author Robby |
| 157 | + */ |
| 158 | +$messages['lb'] = array( |
| 159 | + 'emailarticle' => 'Säit per Mail schécken', |
| 160 | + 'ea-heading' => '=== Säit [[$1]] peer E-Mail verschécken ===', |
| 161 | + 'ea-fromgroup' => 'Vun der Grupp:', |
| 162 | + 'ea-articlesend' => 'D\'Säit "$1" gouf verschéckt vum $2', |
| 163 | + 'ea-norecipients' => 'Keng gëlteg E-Mailadress fonnt', |
| 164 | + 'ea-denied' => 'Rechter refuséiert', |
| 165 | + 'ea-selectrecipients' => 'Adressaten erauswielen', |
| 166 | + 'ea-show' => 'Adressate weisen', |
| 167 | + 'ea-send' => 'Schécken!', |
| 168 | + 'ea-subject' => "Gitt w.e.g. e Sujet fir d'E-Mail an", |
| 169 | + 'ea-selectcss' => "Een ''CSS Stylesheet'' auswielen", |
| 170 | +); |
| 171 | + |
| 172 | +/** Malayalam (മലയാളം) |
| 173 | + * @author Shijualex |
| 174 | + */ |
| 175 | +$messages['ml'] = array( |
| 176 | + 'emailarticle' => 'ഇമെയില് താള്', |
| 177 | + 'ea-heading' => '=== [[$1]] എന്ന താള് ഇമെയില് ചെയ്യുന്നു ===', |
| 178 | + 'ea-fromgroup' => 'ഗ്രൂപ്പ്:', |
| 179 | + 'ea-articlesend' => '$2 സംരംഭത്തില് നിന്നു "$1" എന്ന താള് അയച്ചു', |
| 180 | + 'ea-noarticle' => 'അയക്കുവാന് വേണ്ടി ഒരു താള് തിരഞ്ഞെടുക്കുക. ഉദാ: [[Special:EmailArticle/Main Page]]', |
| 181 | + 'ea-norecipients' => 'സാധുവായ ഇമെയില് വിലാസങ്ങള് കണ്ടില്ല!', |
| 182 | + 'ea-listrecipients' => '=== $1 {{PLURAL:$1|സ്വീകര്ത്താവിന്റെ|സ്വീകര്ത്താക്കളുടെ}} പട്ടിക ===', |
| 183 | + 'ea-error' => "'''[[$1]] അയക്കുന്നതില് പിഴവ്:''' ''$2''", |
| 184 | + 'ea-denied' => 'അനുവാദം നിഷേധിച്ചിരിക്കുന്നു', |
| 185 | + 'ea-sent' => "[[User:$3|$3]] എന്ന ഉപയോക്താവ് [[$1]] എന്ന താള് വിജയകരമായി '''$2''' {{PLURAL:$2|സ്വീകര്ത്താവിനു|സ്വീകര്ത്താക്കള്ക്ക്}} അയച്ചിരിക്കുന്നു.", |
| 186 | + 'ea-selectrecipients' => 'സ്വീകര്ത്താക്കളെ തിരഞ്ഞെടുക്കുക', |
| 187 | + 'ea-compose' => 'ഉള്ളടക്കം ചേര്ക്കുക', |
| 188 | + 'ea-show' => 'സ്വീകര്ത്താക്കളെ പ്രദര്ശിപ്പിക്കുക', |
| 189 | + 'ea-send' => 'അയക്കൂ!', |
| 190 | + 'ea-subject' => 'ഇമെയിലിനു ഒരു വിഷയം/ശീര്ഷകം ചേര്ക്കുക', |
| 191 | +); |
| 192 | + |
| 193 | +/** Marathi (मराठी) |
| 194 | + * @author Kaustubh |
| 195 | + */ |
| 196 | +$messages['mr'] = array( |
| 197 | + 'emailarticle' => 'पान इ-मेल करा', |
| 198 | + 'ea-desc' => ' [http://phpmailer.sourceforge.net पीएचपी मेलर] चा वापर करून एखादे पान एखाद्या इ-मेल पत्त्यावर किंवा इ-मेल पत्त्यांच्या यादीवर पाठवा.', |
| 199 | + 'ea-heading' => '=== [[$1]] पान इ-मेल करीत आहे ===', |
| 200 | + 'ea-fromgroup' => 'गटाकडून:', |
| 201 | + 'ea-articlesend' => '$2 ने "$1" पान पाठविले', |
| 202 | + 'ea-noarticle' => 'कृपया पाठविण्यासाठी एक पान निवडा, उदाहरणासाठी [[Special:EmailArticle/Main Page]].', |
| 203 | + 'ea-norecipients' => 'योग्य इ-मेल पत्ता सापडला नाही!', |
| 204 | + 'ea-listrecipients' => '=== $1 {{PLURAL:$1|सदस्याची|सदस्यांची}}यादी ===', |
| 205 | + 'ea-error' => "'''पाठविण्यामध्ये त्रुटी [[$1]]:''' ''$2''", |
| 206 | + 'ea-denied' => 'परवानगी नाकारली', |
| 207 | + 'ea-sent' => "[[User:$3|$3]] ने [[$1]] पान '''$2''' {{PLURAL:$2|सदस्याला|सदस्यांना}} पाठविले.", |
| 208 | + 'ea-selectrecipients' => 'सदस्य निवडा', |
| 209 | + 'ea-compose' => 'मजकूर लिहा', |
| 210 | + 'ea-selectlist' => "जास्तीचे सदस्य लेख शीर्षक किंवा इ-मेल पत्ता |
| 211 | +*'', ; चा वापर करून वेगळे करा* \\n |
| 212 | +*''यादी मध्ये साचे तसेच पार्सर क्रिया वापरता येतील''", |
| 213 | + 'ea-show' => 'निवडलेले सदस्य दाखवा', |
| 214 | + 'ea-send' => 'पाठवा!', |
| 215 | + 'ea-subject' => 'इ-मेल चा विषय लिहा', |
| 216 | + 'ea-header' => 'मजकूरा आधी वैकल्पिक संदेश लिहा (विकिसंज्ञा)', |
| 217 | + 'ea-selectcss' => 'सीएसएस स्टाइलशीट पाठवा', |
| 218 | +); |
| 219 | + |
| 220 | +/** Low German (Plattdüütsch) |
| 221 | + * @author Slomox |
| 222 | + */ |
| 223 | +$messages['nds'] = array( |
| 224 | + 'ea-fromgroup' => 'Vun Grupp:', |
| 225 | +); |
| 226 | + |
| 227 | +/** Dutch (Nederlands) |
| 228 | + * @author Siebrand |
| 229 | + */ |
| 230 | +$messages['nl'] = array( |
| 231 | + 'emailarticle' => 'Pagina e-mailen', |
| 232 | + 'ea-desc' => 'Stuur een gerenderde pagina naar een e-mailadres of een lijst van adressen met behulp van [http://phpmailer.sourceforge.net phpmailer].', |
| 233 | + 'ea-heading' => '=== Pagina [[$1]] e-mailen ===', |
| 234 | + 'ea-fromgroup' => 'Van groep:', |
| 235 | + 'ea-articlesend' => 'Pagina "$1" is vanuit $2 verstuurd', |
| 236 | + 'ea-noarticle' => 'Geef een pagina op om te versturen, bijvoorbeeld [[Special:EmailArticle/Hoofdpagina]].', |
| 237 | + 'ea-norecipients' => 'Er is geen geldig e-mailadres opgegeven!', |
| 238 | + 'ea-listrecipients' => '=== Lijst met $1 {{PLURAL:$1|ontvanger|ontvangers}} ===', |
| 239 | + 'ea-error' => "'''Fout bij het versturen van [[$1]]:''' ''$2''", |
| 240 | + 'ea-denied' => 'U hebt geen rechten om deze handeling uit te voeren', |
| 241 | + 'ea-sent' => "Pagina [[$1]] is verstuurd naar '''$2''' {{PLURAL:$2|ontvanger|ontvangers}} door [[User:$3|$3]].", |
| 242 | + 'ea-selectrecipients' => 'Ontvangers selecteren', |
| 243 | + 'ea-compose' => 'Inhoud samenstellen', |
| 244 | + 'ea-selectlist' => 'Meer ontvangers als paginanamen of e-mailadressen |
| 245 | +*\'\'u kunt adressen scheiden met ",", ";", "*", of "\\n" |
| 246 | +*\'\'de lijst mag sjablonen en parserfuncties bevatten\'\'', |
| 247 | + 'ea-show' => 'Ontvangers weergeven', |
| 248 | + 'ea-send' => 'Versturen', |
| 249 | + 'ea-subject' => 'Voer een onderwerp in voor de e-mail', |
| 250 | + 'ea-header' => 'Laat de pagina-inhoud vooraf gaan door een bericht (in wikitekst)', |
| 251 | + 'ea-selectcss' => 'Selecteer een CSS', |
| 252 | +); |
| 253 | + |
| 254 | +/** Norwegian (bokmål) (Norsk (bokmål)) |
| 255 | + * @author Jon Harald Søby |
| 256 | + */ |
| 257 | +$messages['no'] = array( |
| 258 | + 'emailarticle' => 'Send side som e-post', |
| 259 | + 'ea-desc' => 'Send HTML-side til en eller flere e-postadresser ved hjelp av [http://phpmailer.sourceforge.net/ phpmailer].', |
| 260 | + 'ea-heading' => '=== Send siden [[$1]] som e-post ===', |
| 261 | + 'ea-fromgroup' => 'Fra gruppe:', |
| 262 | + 'ea-articlesend' => 'Siden «$1» sendt fra $2', |
| 263 | + 'ea-noarticle' => 'Oppgi en side du vil sende, for eksempel [[Special:EmailArticle/{{MediaWiki:Mainpage}}]].', |
| 264 | + 'ea-norecipients' => 'Ingen gyldige e-postadresser funnet.', |
| 265 | + 'ea-listrecipients' => '=== Liste over $1 {{PLURAL:$1|mottaker|mottakere}} ===', |
| 266 | + 'ea-error' => "'''Feil under sending av [[$1]]:''' ''$2''", |
| 267 | + 'ea-denied' => 'Ingen adgang', |
| 268 | + 'ea-sent' => "Siden [[$1]] ble sendt til '''$2''' {{PLURAL:$2|mottaker|mottakere}} av [[User:$3|$3]].", |
| 269 | + 'ea-selectrecipients' => 'Velg mottakere', |
| 270 | + 'ea-compose' => 'Skriv inn innhold', |
| 271 | + 'ea-selectlist' => "Ytterligere mottakere som sidetitler eller e-postadresser |
| 272 | +* ''skill elementer med , ; * \\n |
| 273 | +* ''listen kan inneholde maler og parserfunksjoner''", |
| 274 | + 'ea-show' => 'Vis mottakere', |
| 275 | + 'ea-send' => 'Send', |
| 276 | + 'ea-subject' => 'Skriv inn et emne for e-posten', |
| 277 | + 'ea-header' => 'Fyll innholdet med en valgfri beskjed (wikitekst)', |
| 278 | + 'ea-selectcss' => 'Angi en CSS-stilmal', |
| 279 | +); |
| 280 | + |
| 281 | +/** Occitan (Occitan) |
| 282 | + * @author Cedric31 |
| 283 | + */ |
| 284 | +$messages['oc'] = array( |
| 285 | + 'emailarticle' => 'Mandar l’article per corrièr electronic', |
| 286 | + 'ea-desc' => 'Manda lo rendut d’una pagina HTML a una adreça electronica o a una tièra d’adreças en utilizant [http://phpmailer.sourceforge.net phpmailer]', |
| 287 | + 'ea-heading' => '=== Mandadís de la pagina [[$1]] per corrièr electronic ===', |
| 288 | + 'ea-fromgroup' => 'Dempuèi lo grop :', |
| 289 | + 'ea-articlesend' => 'Pagina « $1 » mandada dempuèi $2', |
| 290 | + 'ea-noarticle' => 'Especificatz una pagina de mandar, per exemple [[Special:EmailArticle/Acuèlh]]', |
| 291 | + 'ea-norecipients' => "Cap d'adreça de corrièr electronic pas trobada !", |
| 292 | + 'ea-listrecipients' => '=== Tièra de $1 {{PLURAL:$1|destinatari|destinataris}} ===', |
| 293 | + 'ea-error' => "'''Error del mandadís de [[$1]] :''' ''$2''", |
| 294 | + 'ea-denied' => 'Permission refusada', |
| 295 | + 'ea-sent' => "L'article [[$1]] es estat mandat amb succès a '''$2''' {{PLURAL:$2|destinatari|destinataris}} per [[User:$3|$3]].", |
| 296 | + 'ea-selectrecipients' => 'Seleccionar los destinataris', |
| 297 | + 'ea-compose' => 'Compausar lo contengut', |
| 298 | + 'ea-selectlist' => "Destinataris suplementaris coma los títols d'articles o las adreças de corrièr electronic |
| 299 | +* ''separar los articles amb , : * \\n'' |
| 300 | +* ''la tièra pòt conténer de modèls e de foncions parsaires''", |
| 301 | + 'ea-show' => 'Visionar los destinataris', |
| 302 | + 'ea-send' => 'Mandar !', |
| 303 | + 'ea-subject' => 'Entrar una linha « objècte » pel corrièr electronic', |
| 304 | + 'ea-header' => 'Apondre lo contengut al començament amb un messatge facultatiu (tèxt wiki)', |
| 305 | + 'ea-selectcss' => "Seleccionar un fuèlh d'estil CSS", |
| 306 | +); |
| 307 | + |
| 308 | +/** Slovak (Slovenčina) |
| 309 | + * @author Helix84 |
| 310 | + */ |
| 311 | +$messages['sk'] = array( |
| 312 | + 'emailarticle' => 'Poslať stránku emailom', |
| 313 | + 'ea-desc' => 'Poslať stránku vo formáte HTML na emailovú adresu alebo zoznam adries pomocou [http://phpmailer.sourceforge.net phpmailer].', |
| 314 | + 'ea-heading' => '=== Poslanie stránky [[$1]] emailom ===', |
| 315 | + 'ea-fromgroup' => 'Zo skupiny:', |
| 316 | + 'ea-articlesend' => 'Článok „$1” poslaný z $2', |
| 317 | + 'ea-noarticle' => 'Prosím, uveďte stránku, ktorú chcete poslať, napr. [[Special:EmailArticle/Hlavná stránka]].', |
| 318 | + 'ea-norecipients' => 'Nebola nájdená platná emailová adresa!', |
| 319 | + 'ea-listrecipients' => '=== Zoznam $1 {{PLURAL:$1|príjemcu|príjemcov}} ===', |
| 320 | + 'ea-error' => "'''Chyba pri odosielaní [[$1]]:''' ''$2''", |
| 321 | + 'ea-denied' => 'Nemáte potrebné oprávnenie', |
| 322 | + 'ea-sent' => "[[User:$3|$3]] úspešne poslal stránku [[$1]] '''$2''' {{PLURAL:$2|používateľovi|používateľom}}.", |
| 323 | + 'ea-selectrecipients' => 'Vybrať príjemcov', |
| 324 | + 'ea-compose' => 'Napísať obsah správy', |
| 325 | + 'ea-selectlist' => "Ďalší príjemci vo forme názvov stránok alebo emailových adries |
| 326 | +*''položky oddeľujte pomocu , ; * \\n |
| 327 | +*''zoznam môže obsahovať šablóny a funkcie syntaktického analyzátora''", |
| 328 | + 'ea-show' => 'Zobraziť príjemcov', |
| 329 | + 'ea-send' => 'Poslať!', |
| 330 | + 'ea-subject' => 'Zadajte predmet emailu', |
| 331 | + 'ea-header' => 'Pred obsah pridať (nepovinne) správu (wikitext)', |
| 332 | + 'ea-selectcss' => 'Vyberte CSS štýl', |
| 333 | +); |
| 334 | + |
| 335 | +/** Sundanese (Basa Sunda) |
| 336 | + * @author Irwangatot |
| 337 | + */ |
| 338 | +$messages['su'] = array( |
| 339 | + 'ea-send' => 'Kintun!', |
| 340 | +); |
| 341 | + |
| 342 | +/** Swedish (Svenska) |
| 343 | + * @author M.M.S. |
| 344 | + */ |
| 345 | +$messages['sv'] = array( |
| 346 | + 'emailarticle' => 'E-posta sida', |
| 347 | + 'ea-desc' => 'Skicka en renderad HTML-sida till en e-postadress eller en lista över adresser som använder [http://phpmailer.sourceforge.net phpmailer].', |
| 348 | + 'ea-heading' => '=== E-posta sidan [[$1]] ===', |
| 349 | + 'ea-fromgroup' => 'Från grupp:', |
| 350 | + 'ea-articlesend' => 'Artikeln "$1" skickades från $2', |
| 351 | + 'ea-noarticle' => 'Var god ange en sida att skicka, för exempel [[Special:EmailArticle/Main Page]].', |
| 352 | + 'ea-norecipients' => 'Inga giltiga e-postadresser hittades!', |
| 353 | + 'ea-listrecipients' => '=== Lista över $1 {{PLURAL:$1|mottagare|mottagare}} ===', |
| 354 | + 'ea-error' => "'''Fel under sändande av [[$1]]:''' ''$2''", |
| 355 | + 'ea-denied' => 'Åtkomst nekas', |
| 356 | + 'ea-sent' => "Sidan [[$1]] har skickats till '''$2''' {{PLURAL:$2|mottagare|mottagare}} av [[User:$3|$3]].", |
| 357 | + 'ea-selectrecipients' => 'Ange mottagare', |
| 358 | + 'ea-compose' => 'Komponera innehåll', |
| 359 | + 'ea-selectlist' => "Ytterligare mottagare som sidtitlar eller e-postadresser |
| 360 | +*''separera element med, ; * \\n |
| 361 | +*''listor kan innehålla mallar och parser-funktioner''", |
| 362 | + 'ea-show' => 'Visa mottagare', |
| 363 | + 'ea-send' => 'Skicka!', |
| 364 | + 'ea-subject' => 'Ange ett ämne för e-brevet', |
| 365 | + 'ea-header' => 'Fyll innehållet med ett valfritt meddelande (wikitext)', |
| 366 | + 'ea-selectcss' => 'Ange en CSS-stilmall', |
| 367 | +); |
| 368 | + |
| 369 | +/** Telugu (తెలుగు) |
| 370 | + * @author వైజాసత్య |
| 371 | + * @author Veeven |
| 372 | + */ |
| 373 | +$messages['te'] = array( |
| 374 | + 'ea-denied' => 'అనుమతిని నిరాకరించాం', |
| 375 | + 'ea-send' => 'పంపించు!', |
| 376 | +); |
| 377 | + |
| 378 | +/** Vietnamese (Tiếng Việt) |
| 379 | + * @author Vinhtantran |
| 380 | + */ |
| 381 | +$messages['vi'] = array( |
| 382 | + 'emailarticle' => 'Trang thư điện tử', |
| 383 | + 'ea-desc' => 'Gửi trang HTML giản lược đến một địa chỉ hoặc danh sách các địa chỉ thư điện tử dùng [http://phpmailer.sourceforge.net phpmailer].', |
| 384 | + 'ea-heading' => '=== Gửi trang [[$1]] ===', |
| 385 | + 'ea-noarticle' => 'Xin hãy xác định trang muốn gửi, ví dụ [[Special:EmailArticle/Trang_Chính]].', |
| 386 | + 'ea-norecipients' => 'Không tìm thấy địa chỉ thư điện tử hợp lệ!', |
| 387 | + 'ea-listrecipients' => '=== Danh sách $1 {{PLURAL:$1|người nhận|người nhận}} ===', |
| 388 | + 'ea-error' => "'''Lỗi khi gửi [[$1]]:''' ''$2''", |
| 389 | + 'ea-sent' => "Trang [[$1]] đã được [[User:$3|$3]] gửi thành công đến '''$2''' {{PLURAL:$2|người nhận|người nhận}}.", |
| 390 | + 'ea-selectrecipients' => 'Chọn người nhận', |
| 391 | + 'ea-compose' => 'Soạn nội dung', |
| 392 | + 'ea-selectlist' => "Những người nhận khác theo tựa đề trang hoặc địa chỉ thư điện tử |
| 393 | +*''phân cách các mục bằng , ; * \\n |
| 394 | +*''danh sách có thể chứa tiêu bản và hàm cú pháp''", |
| 395 | + 'ea-show' => 'Hiển thị người nhận', |
| 396 | + 'ea-send' => 'Gửi!', |
| 397 | + 'ea-subject' => 'Nhập vào dòng tiêu đề cho thư điện tử', |
| 398 | + 'ea-header' => 'Gắn nội dung với thông điệp tùy chọn (văn bản wiki)', |
| 399 | + 'ea-selectcss' => 'Lựa chọn một kiểu trình bày CSS', |
| 400 | +); |
| 401 | + |
Property changes on: trunk/extensions/EmailArticle/EmailArticle.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 402 | + native |
Index: trunk/extensions/EmailArticle/EmailArticle.php |
— | — | @@ -0,0 +1,73 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * EmailArticle extension - Send rendered HTML article to an email address or list of addresses using phpmailer |
| 5 | + * |
| 6 | + * See http://www.mediawiki.org/wiki/Extension:EmailArticle for installation and usage details |
| 7 | + * |
| 8 | + * @package MediaWiki |
| 9 | + * @subpackage Extensions |
| 10 | + * @author Aran Dunkley [http://www.organicdesign.co.nz/nad User:Nad] |
| 11 | + * @copyright © 2007 Aran Dunkley |
| 12 | + * @licence GNU General Public Licence 2.0 or later |
| 13 | + */ |
| 14 | + |
| 15 | +if (!defined('MEDIAWIKI')) die('Not an entry point.'); |
| 16 | + |
| 17 | +define('EMAILARTICLE_VERSION', '1.1.0, 2008-06-04'); |
| 18 | + |
| 19 | +$wgEmailArticleGroup = 'sysop'; # Users must belong to this group to send emails (empty string means anyone can send) |
| 20 | +$wgEmailArticleContactsCat = ''; # This specifies the name of a category containing categories of contact articles |
| 21 | +$wgEmailArticleCss = 'EmailArticle.css'; # A minimal CSS article to embed in the email (eg. monobook/main.css without portlets, actions etc) |
| 22 | +$wgEmailArticleAllowRemoteAddr = array($_SERVER['SERVER_ADDR'],'127.0.0.1'); # Allow anonymous sending from these addresses |
| 23 | +$wgEmailArticleAllowAllUsers = false; # Whether to allow sending to all users (the "user" group) |
| 24 | +$wgEmailArticleToolboxLink = 'Send to email'; # Link title for toolbox link (set to "" to not have any link in toolbox) |
| 25 | +$wgEmailArticleActionLink = 'email'; # Link title for action link (set to "" to not have any action link) |
| 26 | +$wgPhpMailerClass = dirname(__FILE__).'/phpMailer_v2.1.0beta2/class.phpmailer.php'; # From http://phpmailer.sourceforge.net/ |
| 27 | + |
| 28 | +if ($wgEmailArticleGroup) $wgGroupPermissions['sysop'][$wgEmailArticleGroup] = true; |
| 29 | + |
| 30 | +$dir = dirname(__FILE__) . '/'; |
| 31 | +$wgAutoloadClasses['SpecialEmailArticle'] = $dir . 'EmailArticle_body.php'; |
| 32 | +$wgExtensionMessagesFiles['EmailArticle'] = $dir . 'EmailArticle.i18n.php'; |
| 33 | +$wgExtensionAliasesFiles['EmailArticle'] = $dir . 'EmailArticle.alias.php'; |
| 34 | +$wgSpecialPages['EmailArticle'] = 'SpecialEmailArticle'; |
| 35 | + |
| 36 | +$wgExtensionCredits['specialpage'][] = array( |
| 37 | + 'name' => 'Special:EmailArticle', |
| 38 | + 'author' => '[http://www.organicdesign.co.nz/nad User:Nad]', |
| 39 | + 'description' => 'Send rendered HTML article to an email address or list of addresses using [http://phpmailer.sourceforge.net phpmailer].', |
| 40 | + 'descriptionmsg' => 'ea-desc', |
| 41 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:EmailArticle', |
| 42 | + 'version' => EMAILARTICLE_VERSION |
| 43 | +); |
| 44 | + |
| 45 | +# If form has been posted, include the phpmailer class |
| 46 | +if (isset($_REQUEST['ea-send'])) require_once($wgPhpMailerClass); |
| 47 | + |
| 48 | +# Add toolbox and action links |
| 49 | +if ($wgEmailArticleToolboxLink) { |
| 50 | + $wgHooks['MonoBookTemplateToolboxEnd'][] = 'wfEmailArticleToolboxLink'; |
| 51 | +} |
| 52 | + |
| 53 | +if ($wgEmailArticleActionLink) { |
| 54 | + $wgHooks['SkinTemplateTabs'][] = 'wfEmailArticleActionLink'; |
| 55 | +} |
| 56 | + |
| 57 | +function wfEmailArticleToolboxLink() { |
| 58 | + global $wgEmailArticleToolboxLink,$wgTitle; |
| 59 | + if (is_object($wgTitle)) { |
| 60 | + $url = Title::makeTitle(NS_SPECIAL,'EmailArticle')->getLocalURL('ea-title='.$wgTitle->getPrefixedText()); |
| 61 | + echo("<li><a href=\"$url\">$wgEmailArticleToolboxLink</li>"); |
| 62 | + } |
| 63 | + return true; |
| 64 | +} |
| 65 | + |
| 66 | + |
| 67 | +function wfEmailArticleActionLink(&$skin,&$actions) { |
| 68 | + global $wgEmailArticleActionLink,$wgTitle; |
| 69 | + if (is_object($wgTitle)) { |
| 70 | + $url = Title::makeTitle(NS_SPECIAL,'EmailArticle')->getLocalURL('ea-title='.$wgTitle->getPrefixedText()); |
| 71 | + $actions['email'] = array('text' => $wgEmailArticleActionLink, 'class' => false, 'href' => $url); |
| 72 | + } |
| 73 | + return true; |
| 74 | +} |
Property changes on: trunk/extensions/EmailArticle/EmailArticle.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 75 | + native |
Index: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/codeworxtech.html |
— | — | @@ -0,0 +1,72 @@ |
| 2 | +<html> |
| 3 | +<head> |
| 4 | +<style> |
| 5 | +body, p { |
| 6 | + font-family: Arial, Helvetica, sans-serif; |
| 7 | + font-size: 12px; |
| 8 | +} |
| 9 | +div.width { |
| 10 | + width: 500px; |
| 11 | + text-align: left; |
| 12 | +} |
| 13 | +</style> |
| 14 | +</head> |
| 15 | +<body> |
| 16 | +<center> |
| 17 | +<div class="width"> |
| 18 | +<p><b>My name is Andy Prevost, AKA "codeworxtech".</b><br> |
| 19 | +<a href="http://www.codeworxtech.com">www.codeworxtech.com</a> for more information.<br> |
| 20 | +<a href="http://www.worxhost.com">www.worxhost.com</a> our webhosting division.</p> |
| 21 | +<p>Before I introduce myself, our company and our developer tools to you, let me answer a huge question you likely have:</p> |
| 22 | +<p><strong>WHY USE OUR TOOLS & WHAT'S IN IT FOR YOU?</strong></p> |
| 23 | +<p>A valid question. We're developers too. We've been writing software, primarily for the internet, for more than 15 years. Along the way, there are two major things that had tremendous impact of our company: PHP and Open Source. PHP is without doubt the most popular platform for the internet. There has been more progress in this area of technology because of Open Source software than in any other IT segment. We have used many open source tools, some as learning tools, some as components in projects we were working on. To us, it's not about popularity ... we're committed to robust, stable, and efficient tools you can use to get your projects in your user's hands quickly. So the shorter answer: what's in it for you? rapid development and rapid deployment without fuss and with straight forward open source licensing.</p> |
| 24 | +<p>Now, the introductions:</p> |
| 25 | +<p>Our company, <strong>Codeworx Technologies</strong>, is the publisher of several Open Source applications and developer tools as well as several commercial PHP applications. The Open Source applications are ttCMS and DCP Portal. The Open Source developer tools include QuickComponents (QuickSkin, QuickCache, and QuickTabs) and now PHPMailer. |
| 26 | +We have staff and offices in the United States, Canada, Caribbean, the Middle |
| 27 | +East, and our primary development center in India. Our company is represented by |
| 28 | +agents and resellers globally.</p> |
| 29 | +<p><strong>Codeworx Technologies</strong> is at the forefront of developing PHP applications. Our staff are all Zend Certified university educated and experts at object oriented programming. While <strong>Codeworx Technologies</strong> can handle any project from trouble shooting programs written by others all the way to finished mission-critical applications, we specialize in taking projects from inception all the way through to implementation - on budget, and on time. If you need help with your projects, we're the team to get it done right at a reasonable price.</p> |
| 30 | +<p>Over the years, there have been a number of tools that have been constant favorites in all of our projects. We have become the project administrators for most of these tools.</p> |
| 31 | +<p>Our developer tools are all Open Source. Here's a brief description:</p> |
| 32 | +<ul> |
| 33 | + <li><strong>PHPMailer</strong>. Originally authored by Brent Matzelle, PHPMailer is the leading "email transfer class" for PHP. PHPMailer is downloaded more than 18000 times each and every month by developers looking for a stable, simple email solution. We used it ourselves for years as our favorite tool. It's always been small (the entire footprint is around 100 Kb), stable, and as complete a solution as you can find. Other tools are nowhere near as simple. And more importantly, most of our applications (including PHPMailer) is implemented in a smaller footprint than one competing email class. Our thanks to Brent Matzelle for this superb tool - our commitment is to keep it lean, keep it focused, and compliant with standards. Visit the PHPMailer website at |
| 34 | + <a href="http://phpmailer.codeworxtech.com/">http://phpmailer.codeworxtech.com/</a>.<br> |
| 35 | + <br> |
| 36 | + </li> |
| 37 | + <li><strong>QuickCache</strong>. Originally authored by Jean Pierre Deckers as jpCache, QuickCache is an HTTP OpCode caching strategy that works on your entire site with only one line of code at the top of your script. The cached pages can be stored as files or as database objects. The benefits are absolutely astounding: bandwidth savings of up to 80% and screen display times increased by 8 - 10x. Visit the QuickCache website at |
| 38 | + <a href="http://quickcache.codeworxtech.com/">http://quickcache.codeworxtech.com/</a>.<br> |
| 39 | + <br> |
| 40 | + </li> |
| 41 | + <li><strong>QuickSkin</strong>. Originally authored by Philipp v. Criegern and named "SmartTemplate". The project was taken over by Manuel 'EndelWar' Dalla Lana and now by "codeworxtech". QuickSkin is one of the truly outstanding templating engines available, but has always been confused with Smarty Templating Engine. QuickSkin is even more relevant today than when it was launched. It's a small footprint with big impact on your projects. It features a built in caching technology, token based substitution, and works on the concept of one single HTML file as the template. The HTML template file can contain variable information making it one small powerful tool for your developer tool kit. Visit the QuickSkin website at |
| 42 | + <a href="http://quickskin.codeworxtech.com/">http://quickskin.codeworxtech.com/</a>.<br> |
| 43 | + <br> |
| 44 | + </li> |
| 45 | + <li><strong>QuickTabs</strong>. If you read about the projects above, you'll get the sense that we are minimalists and that's pretty accurate. We prefer using tools that are small, efficient, and effective. We have no use for software bloat. QuickTabs came to life in several of our projects where we needed to display complex information in a simplified manner to users. It had to function something like a "wizard" interface, but with more flexibility to float from one item to another. We looked at various Ajax-based solutions, but found one annoying problem with Ajax - page reloads if switching between items (with corresponding data loss if changed by the customer). QuickTabs is our solution to this by presenting complex data in a Javascript show/hide div set. It's not a complex architecture, but it works! Visit the QuickTabs website at <a href="http://quicktabs.codeworxtech.com/">http://quicktabs.codeworxtech.com/</a>.</li> |
| 46 | +</ul> |
| 47 | +<p>We're committed to PHP and to the Open Source community.</p> |
| 48 | +<p>Opportunities with <strong>Codeworx Technologies</strong>:</p> |
| 49 | +<ul> |
| 50 | +<li>Resellers/Agents: We're always interested in talking with companies that |
| 51 | +want to represent |
| 52 | +<strong>Codeworx Technologies</strong> in their markets. We also have private label programs for our commercial products (in certain circumstances).</li> |
| 53 | +<li>Programmers/Developers: We are usually fully staffed, however, if you would like to be considered for a career with |
| 54 | +<strong>Codeworx Technologies</strong>, we would be pleased to hear from you.<br> |
| 55 | +A few things to note:<br> |
| 56 | +<ul> |
| 57 | + <li>we do not hire contractors and we do not outsource (these are services we offer)</li> |
| 58 | + <li>experience level does not matter: from fresh out of college to multi-year experience - it's your |
| 59 | + creative mind and a positive attitude we want</li> |
| 60 | + <li>if you contact us looking for employment, include a cover letter, indicate what type of work/career you are looking for and expected compensation</li> |
| 61 | + <li>if you are representing someone else looking for work, do not contact us. We have an exclusive relationship with a recruiting partner already and not interested in altering the arrangement. We will not hire your candidate under any circumstances unless they wish to approach us individually.</li> |
| 62 | + <li>any contact that ignores any of these points will be discarded</li> |
| 63 | +</ul></li> |
| 64 | +<li>Affiliates/Partnerships: We are interested in partnering with other firms who are leaders in their field. We clearly understand that successful companies are built on successful relationships in all industries world-wide. We currently have innovative relationships throughout the world that are mutually beneficial. Drop us a line and let's talk.</li> |
| 65 | +</ul> |
| 66 | +Regards,<br> |
| 67 | +Andy Prevost (aka, codeworxtech)<br> |
| 68 | +<a href="mailto:codeworxtech@users.sourceforge.net">codeworxtech@users.sourceforge.net</a><br> |
| 69 | +<br> |
| 70 | +</div> |
| 71 | +</center> |
| 72 | +</body> |
| 73 | +</html> |
Property changes on: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/codeworxtech.html |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 74 | + native |
Index: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/LICENSE |
— | — | @@ -0,0 +1,504 @@ |
| 2 | + GNU LESSER GENERAL PUBLIC LICENSE |
| 3 | + Version 2.1, February 1999 |
| 4 | + |
| 5 | + Copyright (C) 1991, 1999 Free Software Foundation, Inc. |
| 6 | + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 7 | + Everyone is permitted to copy and distribute verbatim copies |
| 8 | + of this license document, but changing it is not allowed. |
| 9 | + |
| 10 | +[This is the first released version of the Lesser GPL. It also counts |
| 11 | + as the successor of the GNU Library Public License, version 2, hence |
| 12 | + the version number 2.1.] |
| 13 | + |
| 14 | + Preamble |
| 15 | + |
| 16 | + The licenses for most software are designed to take away your |
| 17 | +freedom to share and change it. By contrast, the GNU General Public |
| 18 | +Licenses are intended to guarantee your freedom to share and change |
| 19 | +free software--to make sure the software is free for all its users. |
| 20 | + |
| 21 | + This license, the Lesser General Public License, applies to some |
| 22 | +specially designated software packages--typically libraries--of the |
| 23 | +Free Software Foundation and other authors who decide to use it. You |
| 24 | +can use it too, but we suggest you first think carefully about whether |
| 25 | +this license or the ordinary General Public License is the better |
| 26 | +strategy to use in any particular case, based on the explanations below. |
| 27 | + |
| 28 | + When we speak of free software, we are referring to freedom of use, |
| 29 | +not price. Our General Public Licenses are designed to make sure that |
| 30 | +you have the freedom to distribute copies of free software (and charge |
| 31 | +for this service if you wish); that you receive source code or can get |
| 32 | +it if you want it; that you can change the software and use pieces of |
| 33 | +it in new free programs; and that you are informed that you can do |
| 34 | +these things. |
| 35 | + |
| 36 | + To protect your rights, we need to make restrictions that forbid |
| 37 | +distributors to deny you these rights or to ask you to surrender these |
| 38 | +rights. These restrictions translate to certain responsibilities for |
| 39 | +you if you distribute copies of the library or if you modify it. |
| 40 | + |
| 41 | + For example, if you distribute copies of the library, whether gratis |
| 42 | +or for a fee, you must give the recipients all the rights that we gave |
| 43 | +you. You must make sure that they, too, receive or can get the source |
| 44 | +code. If you link other code with the library, you must provide |
| 45 | +complete object files to the recipients, so that they can relink them |
| 46 | +with the library after making changes to the library and recompiling |
| 47 | +it. And you must show them these terms so they know their rights. |
| 48 | + |
| 49 | + We protect your rights with a two-step method: (1) we copyright the |
| 50 | +library, and (2) we offer you this license, which gives you legal |
| 51 | +permission to copy, distribute and/or modify the library. |
| 52 | + |
| 53 | + To protect each distributor, we want to make it very clear that |
| 54 | +there is no warranty for the free library. Also, if the library is |
| 55 | +modified by someone else and passed on, the recipients should know |
| 56 | +that what they have is not the original version, so that the original |
| 57 | +author's reputation will not be affected by problems that might be |
| 58 | +introduced by others. |
| 59 | + |
| 60 | + Finally, software patents pose a constant threat to the existence of |
| 61 | +any free program. We wish to make sure that a company cannot |
| 62 | +effectively restrict the users of a free program by obtaining a |
| 63 | +restrictive license from a patent holder. Therefore, we insist that |
| 64 | +any patent license obtained for a version of the library must be |
| 65 | +consistent with the full freedom of use specified in this license. |
| 66 | + |
| 67 | + Most GNU software, including some libraries, is covered by the |
| 68 | +ordinary GNU General Public License. This license, the GNU Lesser |
| 69 | +General Public License, applies to certain designated libraries, and |
| 70 | +is quite different from the ordinary General Public License. We use |
| 71 | +this license for certain libraries in order to permit linking those |
| 72 | +libraries into non-free programs. |
| 73 | + |
| 74 | + When a program is linked with a library, whether statically or using |
| 75 | +a shared library, the combination of the two is legally speaking a |
| 76 | +combined work, a derivative of the original library. The ordinary |
| 77 | +General Public License therefore permits such linking only if the |
| 78 | +entire combination fits its criteria of freedom. The Lesser General |
| 79 | +Public License permits more lax criteria for linking other code with |
| 80 | +the library. |
| 81 | + |
| 82 | + We call this license the "Lesser" General Public License because it |
| 83 | +does Less to protect the user's freedom than the ordinary General |
| 84 | +Public License. It also provides other free software developers Less |
| 85 | +of an advantage over competing non-free programs. These disadvantages |
| 86 | +are the reason we use the ordinary General Public License for many |
| 87 | +libraries. However, the Lesser license provides advantages in certain |
| 88 | +special circumstances. |
| 89 | + |
| 90 | + For example, on rare occasions, there may be a special need to |
| 91 | +encourage the widest possible use of a certain library, so that it becomes |
| 92 | +a de-facto standard. To achieve this, non-free programs must be |
| 93 | +allowed to use the library. A more frequent case is that a free |
| 94 | +library does the same job as widely used non-free libraries. In this |
| 95 | +case, there is little to gain by limiting the free library to free |
| 96 | +software only, so we use the Lesser General Public License. |
| 97 | + |
| 98 | + In other cases, permission to use a particular library in non-free |
| 99 | +programs enables a greater number of people to use a large body of |
| 100 | +free software. For example, permission to use the GNU C Library in |
| 101 | +non-free programs enables many more people to use the whole GNU |
| 102 | +operating system, as well as its variant, the GNU/Linux operating |
| 103 | +system. |
| 104 | + |
| 105 | + Although the Lesser General Public License is Less protective of the |
| 106 | +users' freedom, it does ensure that the user of a program that is |
| 107 | +linked with the Library has the freedom and the wherewithal to run |
| 108 | +that program using a modified version of the Library. |
| 109 | + |
| 110 | + The precise terms and conditions for copying, distribution and |
| 111 | +modification follow. Pay close attention to the difference between a |
| 112 | +"work based on the library" and a "work that uses the library". The |
| 113 | +former contains code derived from the library, whereas the latter must |
| 114 | +be combined with the library in order to run. |
| 115 | + |
| 116 | + GNU LESSER GENERAL PUBLIC LICENSE |
| 117 | + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
| 118 | + |
| 119 | + 0. This License Agreement applies to any software library or other |
| 120 | +program which contains a notice placed by the copyright holder or |
| 121 | +other authorized party saying it may be distributed under the terms of |
| 122 | +this Lesser General Public License (also called "this License"). |
| 123 | +Each licensee is addressed as "you". |
| 124 | + |
| 125 | + A "library" means a collection of software functions and/or data |
| 126 | +prepared so as to be conveniently linked with application programs |
| 127 | +(which use some of those functions and data) to form executables. |
| 128 | + |
| 129 | + The "Library", below, refers to any such software library or work |
| 130 | +which has been distributed under these terms. A "work based on the |
| 131 | +Library" means either the Library or any derivative work under |
| 132 | +copyright law: that is to say, a work containing the Library or a |
| 133 | +portion of it, either verbatim or with modifications and/or translated |
| 134 | +straightforwardly into another language. (Hereinafter, translation is |
| 135 | +included without limitation in the term "modification".) |
| 136 | + |
| 137 | + "Source code" for a work means the preferred form of the work for |
| 138 | +making modifications to it. For a library, complete source code means |
| 139 | +all the source code for all modules it contains, plus any associated |
| 140 | +interface definition files, plus the scripts used to control compilation |
| 141 | +and installation of the library. |
| 142 | + |
| 143 | + Activities other than copying, distribution and modification are not |
| 144 | +covered by this License; they are outside its scope. The act of |
| 145 | +running a program using the Library is not restricted, and output from |
| 146 | +such a program is covered only if its contents constitute a work based |
| 147 | +on the Library (independent of the use of the Library in a tool for |
| 148 | +writing it). Whether that is true depends on what the Library does |
| 149 | +and what the program that uses the Library does. |
| 150 | + |
| 151 | + 1. You may copy and distribute verbatim copies of the Library's |
| 152 | +complete source code as you receive it, in any medium, provided that |
| 153 | +you conspicuously and appropriately publish on each copy an |
| 154 | +appropriate copyright notice and disclaimer of warranty; keep intact |
| 155 | +all the notices that refer to this License and to the absence of any |
| 156 | +warranty; and distribute a copy of this License along with the |
| 157 | +Library. |
| 158 | + |
| 159 | + You may charge a fee for the physical act of transferring a copy, |
| 160 | +and you may at your option offer warranty protection in exchange for a |
| 161 | +fee. |
| 162 | + |
| 163 | + 2. You may modify your copy or copies of the Library or any portion |
| 164 | +of it, thus forming a work based on the Library, and copy and |
| 165 | +distribute such modifications or work under the terms of Section 1 |
| 166 | +above, provided that you also meet all of these conditions: |
| 167 | + |
| 168 | + a) The modified work must itself be a software library. |
| 169 | + |
| 170 | + b) You must cause the files modified to carry prominent notices |
| 171 | + stating that you changed the files and the date of any change. |
| 172 | + |
| 173 | + c) You must cause the whole of the work to be licensed at no |
| 174 | + charge to all third parties under the terms of this License. |
| 175 | + |
| 176 | + d) If a facility in the modified Library refers to a function or a |
| 177 | + table of data to be supplied by an application program that uses |
| 178 | + the facility, other than as an argument passed when the facility |
| 179 | + is invoked, then you must make a good faith effort to ensure that, |
| 180 | + in the event an application does not supply such function or |
| 181 | + table, the facility still operates, and performs whatever part of |
| 182 | + its purpose remains meaningful. |
| 183 | + |
| 184 | + (For example, a function in a library to compute square roots has |
| 185 | + a purpose that is entirely well-defined independent of the |
| 186 | + application. Therefore, Subsection 2d requires that any |
| 187 | + application-supplied function or table used by this function must |
| 188 | + be optional: if the application does not supply it, the square |
| 189 | + root function must still compute square roots.) |
| 190 | + |
| 191 | +These requirements apply to the modified work as a whole. If |
| 192 | +identifiable sections of that work are not derived from the Library, |
| 193 | +and can be reasonably considered independent and separate works in |
| 194 | +themselves, then this License, and its terms, do not apply to those |
| 195 | +sections when you distribute them as separate works. But when you |
| 196 | +distribute the same sections as part of a whole which is a work based |
| 197 | +on the Library, the distribution of the whole must be on the terms of |
| 198 | +this License, whose permissions for other licensees extend to the |
| 199 | +entire whole, and thus to each and every part regardless of who wrote |
| 200 | +it. |
| 201 | + |
| 202 | +Thus, it is not the intent of this section to claim rights or contest |
| 203 | +your rights to work written entirely by you; rather, the intent is to |
| 204 | +exercise the right to control the distribution of derivative or |
| 205 | +collective works based on the Library. |
| 206 | + |
| 207 | +In addition, mere aggregation of another work not based on the Library |
| 208 | +with the Library (or with a work based on the Library) on a volume of |
| 209 | +a storage or distribution medium does not bring the other work under |
| 210 | +the scope of this License. |
| 211 | + |
| 212 | + 3. You may opt to apply the terms of the ordinary GNU General Public |
| 213 | +License instead of this License to a given copy of the Library. To do |
| 214 | +this, you must alter all the notices that refer to this License, so |
| 215 | +that they refer to the ordinary GNU General Public License, version 2, |
| 216 | +instead of to this License. (If a newer version than version 2 of the |
| 217 | +ordinary GNU General Public License has appeared, then you can specify |
| 218 | +that version instead if you wish.) Do not make any other change in |
| 219 | +these notices. |
| 220 | + |
| 221 | + Once this change is made in a given copy, it is irreversible for |
| 222 | +that copy, so the ordinary GNU General Public License applies to all |
| 223 | +subsequent copies and derivative works made from that copy. |
| 224 | + |
| 225 | + This option is useful when you wish to copy part of the code of |
| 226 | +the Library into a program that is not a library. |
| 227 | + |
| 228 | + 4. You may copy and distribute the Library (or a portion or |
| 229 | +derivative of it, under Section 2) in object code or executable form |
| 230 | +under the terms of Sections 1 and 2 above provided that you accompany |
| 231 | +it with the complete corresponding machine-readable source code, which |
| 232 | +must be distributed under the terms of Sections 1 and 2 above on a |
| 233 | +medium customarily used for software interchange. |
| 234 | + |
| 235 | + If distribution of object code is made by offering access to copy |
| 236 | +from a designated place, then offering equivalent access to copy the |
| 237 | +source code from the same place satisfies the requirement to |
| 238 | +distribute the source code, even though third parties are not |
| 239 | +compelled to copy the source along with the object code. |
| 240 | + |
| 241 | + 5. A program that contains no derivative of any portion of the |
| 242 | +Library, but is designed to work with the Library by being compiled or |
| 243 | +linked with it, is called a "work that uses the Library". Such a |
| 244 | +work, in isolation, is not a derivative work of the Library, and |
| 245 | +therefore falls outside the scope of this License. |
| 246 | + |
| 247 | + However, linking a "work that uses the Library" with the Library |
| 248 | +creates an executable that is a derivative of the Library (because it |
| 249 | +contains portions of the Library), rather than a "work that uses the |
| 250 | +library". The executable is therefore covered by this License. |
| 251 | +Section 6 states terms for distribution of such executables. |
| 252 | + |
| 253 | + When a "work that uses the Library" uses material from a header file |
| 254 | +that is part of the Library, the object code for the work may be a |
| 255 | +derivative work of the Library even though the source code is not. |
| 256 | +Whether this is true is especially significant if the work can be |
| 257 | +linked without the Library, or if the work is itself a library. The |
| 258 | +threshold for this to be true is not precisely defined by law. |
| 259 | + |
| 260 | + If such an object file uses only numerical parameters, data |
| 261 | +structure layouts and accessors, and small macros and small inline |
| 262 | +functions (ten lines or less in length), then the use of the object |
| 263 | +file is unrestricted, regardless of whether it is legally a derivative |
| 264 | +work. (Executables containing this object code plus portions of the |
| 265 | +Library will still fall under Section 6.) |
| 266 | + |
| 267 | + Otherwise, if the work is a derivative of the Library, you may |
| 268 | +distribute the object code for the work under the terms of Section 6. |
| 269 | +Any executables containing that work also fall under Section 6, |
| 270 | +whether or not they are linked directly with the Library itself. |
| 271 | + |
| 272 | + 6. As an exception to the Sections above, you may also combine or |
| 273 | +link a "work that uses the Library" with the Library to produce a |
| 274 | +work containing portions of the Library, and distribute that work |
| 275 | +under terms of your choice, provided that the terms permit |
| 276 | +modification of the work for the customer's own use and reverse |
| 277 | +engineering for debugging such modifications. |
| 278 | + |
| 279 | + You must give prominent notice with each copy of the work that the |
| 280 | +Library is used in it and that the Library and its use are covered by |
| 281 | +this License. You must supply a copy of this License. If the work |
| 282 | +during execution displays copyright notices, you must include the |
| 283 | +copyright notice for the Library among them, as well as a reference |
| 284 | +directing the user to the copy of this License. Also, you must do one |
| 285 | +of these things: |
| 286 | + |
| 287 | + a) Accompany the work with the complete corresponding |
| 288 | + machine-readable source code for the Library including whatever |
| 289 | + changes were used in the work (which must be distributed under |
| 290 | + Sections 1 and 2 above); and, if the work is an executable linked |
| 291 | + with the Library, with the complete machine-readable "work that |
| 292 | + uses the Library", as object code and/or source code, so that the |
| 293 | + user can modify the Library and then relink to produce a modified |
| 294 | + executable containing the modified Library. (It is understood |
| 295 | + that the user who changes the contents of definitions files in the |
| 296 | + Library will not necessarily be able to recompile the application |
| 297 | + to use the modified definitions.) |
| 298 | + |
| 299 | + b) Use a suitable shared library mechanism for linking with the |
| 300 | + Library. A suitable mechanism is one that (1) uses at run time a |
| 301 | + copy of the library already present on the user's computer system, |
| 302 | + rather than copying library functions into the executable, and (2) |
| 303 | + will operate properly with a modified version of the library, if |
| 304 | + the user installs one, as long as the modified version is |
| 305 | + interface-compatible with the version that the work was made with. |
| 306 | + |
| 307 | + c) Accompany the work with a written offer, valid for at |
| 308 | + least three years, to give the same user the materials |
| 309 | + specified in Subsection 6a, above, for a charge no more |
| 310 | + than the cost of performing this distribution. |
| 311 | + |
| 312 | + d) If distribution of the work is made by offering access to copy |
| 313 | + from a designated place, offer equivalent access to copy the above |
| 314 | + specified materials from the same place. |
| 315 | + |
| 316 | + e) Verify that the user has already received a copy of these |
| 317 | + materials or that you have already sent this user a copy. |
| 318 | + |
| 319 | + For an executable, the required form of the "work that uses the |
| 320 | +Library" must include any data and utility programs needed for |
| 321 | +reproducing the executable from it. However, as a special exception, |
| 322 | +the materials to be distributed need not include anything that is |
| 323 | +normally distributed (in either source or binary form) with the major |
| 324 | +components (compiler, kernel, and so on) of the operating system on |
| 325 | +which the executable runs, unless that component itself accompanies |
| 326 | +the executable. |
| 327 | + |
| 328 | + It may happen that this requirement contradicts the license |
| 329 | +restrictions of other proprietary libraries that do not normally |
| 330 | +accompany the operating system. Such a contradiction means you cannot |
| 331 | +use both them and the Library together in an executable that you |
| 332 | +distribute. |
| 333 | + |
| 334 | + 7. You may place library facilities that are a work based on the |
| 335 | +Library side-by-side in a single library together with other library |
| 336 | +facilities not covered by this License, and distribute such a combined |
| 337 | +library, provided that the separate distribution of the work based on |
| 338 | +the Library and of the other library facilities is otherwise |
| 339 | +permitted, and provided that you do these two things: |
| 340 | + |
| 341 | + a) Accompany the combined library with a copy of the same work |
| 342 | + based on the Library, uncombined with any other library |
| 343 | + facilities. This must be distributed under the terms of the |
| 344 | + Sections above. |
| 345 | + |
| 346 | + b) Give prominent notice with the combined library of the fact |
| 347 | + that part of it is a work based on the Library, and explaining |
| 348 | + where to find the accompanying uncombined form of the same work. |
| 349 | + |
| 350 | + 8. You may not copy, modify, sublicense, link with, or distribute |
| 351 | +the Library except as expressly provided under this License. Any |
| 352 | +attempt otherwise to copy, modify, sublicense, link with, or |
| 353 | +distribute the Library is void, and will automatically terminate your |
| 354 | +rights under this License. However, parties who have received copies, |
| 355 | +or rights, from you under this License will not have their licenses |
| 356 | +terminated so long as such parties remain in full compliance. |
| 357 | + |
| 358 | + 9. You are not required to accept this License, since you have not |
| 359 | +signed it. However, nothing else grants you permission to modify or |
| 360 | +distribute the Library or its derivative works. These actions are |
| 361 | +prohibited by law if you do not accept this License. Therefore, by |
| 362 | +modifying or distributing the Library (or any work based on the |
| 363 | +Library), you indicate your acceptance of this License to do so, and |
| 364 | +all its terms and conditions for copying, distributing or modifying |
| 365 | +the Library or works based on it. |
| 366 | + |
| 367 | + 10. Each time you redistribute the Library (or any work based on the |
| 368 | +Library), the recipient automatically receives a license from the |
| 369 | +original licensor to copy, distribute, link with or modify the Library |
| 370 | +subject to these terms and conditions. You may not impose any further |
| 371 | +restrictions on the recipients' exercise of the rights granted herein. |
| 372 | +You are not responsible for enforcing compliance by third parties with |
| 373 | +this License. |
| 374 | + |
| 375 | + 11. If, as a consequence of a court judgment or allegation of patent |
| 376 | +infringement or for any other reason (not limited to patent issues), |
| 377 | +conditions are imposed on you (whether by court order, agreement or |
| 378 | +otherwise) that contradict the conditions of this License, they do not |
| 379 | +excuse you from the conditions of this License. If you cannot |
| 380 | +distribute so as to satisfy simultaneously your obligations under this |
| 381 | +License and any other pertinent obligations, then as a consequence you |
| 382 | +may not distribute the Library at all. For example, if a patent |
| 383 | +license would not permit royalty-free redistribution of the Library by |
| 384 | +all those who receive copies directly or indirectly through you, then |
| 385 | +the only way you could satisfy both it and this License would be to |
| 386 | +refrain entirely from distribution of the Library. |
| 387 | + |
| 388 | +If any portion of this section is held invalid or unenforceable under any |
| 389 | +particular circumstance, the balance of the section is intended to apply, |
| 390 | +and the section as a whole is intended to apply in other circumstances. |
| 391 | + |
| 392 | +It is not the purpose of this section to induce you to infringe any |
| 393 | +patents or other property right claims or to contest validity of any |
| 394 | +such claims; this section has the sole purpose of protecting the |
| 395 | +integrity of the free software distribution system which is |
| 396 | +implemented by public license practices. Many people have made |
| 397 | +generous contributions to the wide range of software distributed |
| 398 | +through that system in reliance on consistent application of that |
| 399 | +system; it is up to the author/donor to decide if he or she is willing |
| 400 | +to distribute software through any other system and a licensee cannot |
| 401 | +impose that choice. |
| 402 | + |
| 403 | +This section is intended to make thoroughly clear what is believed to |
| 404 | +be a consequence of the rest of this License. |
| 405 | + |
| 406 | + 12. If the distribution and/or use of the Library is restricted in |
| 407 | +certain countries either by patents or by copyrighted interfaces, the |
| 408 | +original copyright holder who places the Library under this License may add |
| 409 | +an explicit geographical distribution limitation excluding those countries, |
| 410 | +so that distribution is permitted only in or among countries not thus |
| 411 | +excluded. In such case, this License incorporates the limitation as if |
| 412 | +written in the body of this License. |
| 413 | + |
| 414 | + 13. The Free Software Foundation may publish revised and/or new |
| 415 | +versions of the Lesser General Public License from time to time. |
| 416 | +Such new versions will be similar in spirit to the present version, |
| 417 | +but may differ in detail to address new problems or concerns. |
| 418 | + |
| 419 | +Each version is given a distinguishing version number. If the Library |
| 420 | +specifies a version number of this License which applies to it and |
| 421 | +"any later version", you have the option of following the terms and |
| 422 | +conditions either of that version or of any later version published by |
| 423 | +the Free Software Foundation. If the Library does not specify a |
| 424 | +license version number, you may choose any version ever published by |
| 425 | +the Free Software Foundation. |
| 426 | + |
| 427 | + 14. If you wish to incorporate parts of the Library into other free |
| 428 | +programs whose distribution conditions are incompatible with these, |
| 429 | +write to the author to ask for permission. For software which is |
| 430 | +copyrighted by the Free Software Foundation, write to the Free |
| 431 | +Software Foundation; we sometimes make exceptions for this. Our |
| 432 | +decision will be guided by the two goals of preserving the free status |
| 433 | +of all derivatives of our free software and of promoting the sharing |
| 434 | +and reuse of software generally. |
| 435 | + |
| 436 | + NO WARRANTY |
| 437 | + |
| 438 | + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO |
| 439 | +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. |
| 440 | +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR |
| 441 | +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY |
| 442 | +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE |
| 443 | +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 444 | +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE |
| 445 | +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME |
| 446 | +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
| 447 | + |
| 448 | + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN |
| 449 | +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY |
| 450 | +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU |
| 451 | +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR |
| 452 | +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE |
| 453 | +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING |
| 454 | +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A |
| 455 | +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF |
| 456 | +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
| 457 | +DAMAGES. |
| 458 | + |
| 459 | + END OF TERMS AND CONDITIONS |
| 460 | + |
| 461 | + How to Apply These Terms to Your New Libraries |
| 462 | + |
| 463 | + If you develop a new library, and you want it to be of the greatest |
| 464 | +possible use to the public, we recommend making it free software that |
| 465 | +everyone can redistribute and change. You can do so by permitting |
| 466 | +redistribution under these terms (or, alternatively, under the terms of the |
| 467 | +ordinary General Public License). |
| 468 | + |
| 469 | + To apply these terms, attach the following notices to the library. It is |
| 470 | +safest to attach them to the start of each source file to most effectively |
| 471 | +convey the exclusion of warranty; and each file should have at least the |
| 472 | +"copyright" line and a pointer to where the full notice is found. |
| 473 | + |
| 474 | + <one line to give the library's name and a brief idea of what it does.> |
| 475 | + Copyright (C) <year> <name of author> |
| 476 | + |
| 477 | + This library is free software; you can redistribute it and/or |
| 478 | + modify it under the terms of the GNU Lesser General Public |
| 479 | + License as published by the Free Software Foundation; either |
| 480 | + version 2.1 of the License, or (at your option) any later version. |
| 481 | + |
| 482 | + This library is distributed in the hope that it will be useful, |
| 483 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 484 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 485 | + Lesser General Public License for more details. |
| 486 | + |
| 487 | + You should have received a copy of the GNU Lesser General Public |
| 488 | + License along with this library; if not, write to the Free Software |
| 489 | + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 490 | + |
| 491 | +Also add information on how to contact you by electronic and paper mail. |
| 492 | + |
| 493 | +You should also get your employer (if you work as a programmer) or your |
| 494 | +school, if any, to sign a "copyright disclaimer" for the library, if |
| 495 | +necessary. Here is a sample; alter the names: |
| 496 | + |
| 497 | + Yoyodyne, Inc., hereby disclaims all copyright interest in the |
| 498 | + library `Frob' (a library for tweaking knobs) written by James Random Hacker. |
| 499 | + |
| 500 | + <signature of Ty Coon>, 1 April 1990 |
| 501 | + Ty Coon, President of Vice |
| 502 | + |
| 503 | +That's all there is to it! |
| 504 | + |
| 505 | + |
Property changes on: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/LICENSE |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 506 | + native |
Index: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/language/phpmailer.lang-no.php |
— | — | @@ -0,0 +1,23 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * PHPMailer language file. |
| 5 | + * Norwegian Version |
| 6 | + */ |
| 7 | + |
| 8 | +$PHPMAILER_LANG = array(); |
| 9 | + |
| 10 | +$PHPMAILER_LANG["provide_address"] = 'Du m� ha med minst en' . |
| 11 | + 'mottager adresse.'; |
| 12 | +$PHPMAILER_LANG["mailer_not_supported"] = ' mailer er ikke supportert.'; |
| 13 | +$PHPMAILER_LANG["execute"] = 'Kunne ikke utf�re: '; |
| 14 | +$PHPMAILER_LANG["instantiate"] = 'Kunne ikke instantiate mail funksjonen.'; |
| 15 | +$PHPMAILER_LANG["authenticate"] = 'SMTP Feil: Kunne ikke authentisere.'; |
| 16 | +$PHPMAILER_LANG["from_failed"] = 'F�lgende Fra feilet: '; |
| 17 | +$PHPMAILER_LANG["recipients_failed"] = 'SMTP Feil: F�lgende' . |
| 18 | + 'mottagere feilet: '; |
| 19 | +$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Feil: Data ble ikke akseptert.'; |
| 20 | +$PHPMAILER_LANG["connect_host"] = 'SMTP Feil: Kunne ikke koble til SMTP host.'; |
| 21 | +$PHPMAILER_LANG["file_access"] = 'Kunne ikke f� tilgang til filen: '; |
| 22 | +$PHPMAILER_LANG["file_open"] = 'Fil feil: Kunne ikke �pne filen: '; |
| 23 | +$PHPMAILER_LANG["encoding"] = 'Ukjent encoding: '; |
| 24 | +?> |
Property changes on: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/language/phpmailer.lang-no.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 25 | + native |
Index: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/language/phpmailer.lang-dk.php |
— | — | @@ -0,0 +1,24 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * PHPMailer language file. |
| 5 | + * Danish Version |
| 6 | + * Author: Mikael Stokkebro <info@stokkebro.dk> |
| 7 | + */ |
| 8 | + |
| 9 | +$PHPMAILER_LANG = array(); |
| 10 | + |
| 11 | +$PHPMAILER_LANG["provide_address"] = 'Du skal indtaste mindst en ' . |
| 12 | + 'modtagers emailadresse.'; |
| 13 | +$PHPMAILER_LANG["mailer_not_supported"] = ' mailer underst�ttes ikke.'; |
| 14 | +$PHPMAILER_LANG["execute"] = 'Kunne ikke k�re: '; |
| 15 | +$PHPMAILER_LANG["instantiate"] = 'Kunne ikke initialisere email funktionen.'; |
| 16 | +$PHPMAILER_LANG["authenticate"] = 'SMTP fejl: Kunne ikke logge p�.'; |
| 17 | +$PHPMAILER_LANG["from_failed"] = 'F�lgende afsenderadresse er forkert: '; |
| 18 | +$PHPMAILER_LANG["recipients_failed"] = 'SMTP fejl: F�lgende' . |
| 19 | + 'modtagere er forkerte: '; |
| 20 | +$PHPMAILER_LANG["data_not_accepted"] = 'SMTP fejl: Data kunne ikke accepteres.'; |
| 21 | +$PHPMAILER_LANG["connect_host"] = 'SMTP fejl: Kunne ikke tilslutte SMTP serveren.'; |
| 22 | +$PHPMAILER_LANG["file_access"] = 'Ingen adgang til fil: '; |
| 23 | +$PHPMAILER_LANG["file_open"] = 'Fil fejl: Kunne ikke �bne filen: '; |
| 24 | +$PHPMAILER_LANG["encoding"] = 'Ukendt encode-format: '; |
| 25 | +?> |
\ No newline at end of file |
Property changes on: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/language/phpmailer.lang-dk.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 26 | + native |
Index: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/language/phpmailer.lang-en.php |
— | — | @@ -0,0 +1,23 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * PHPMailer language file. |
| 5 | + * English Version |
| 6 | + */ |
| 7 | + |
| 8 | +$PHPMAILER_LANG = array(); |
| 9 | + |
| 10 | +$PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' . |
| 11 | + 'recipient email address.'; |
| 12 | +$PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.'; |
| 13 | +$PHPMAILER_LANG["execute"] = 'Could not execute: '; |
| 14 | +$PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.'; |
| 15 | +$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.'; |
| 16 | +$PHPMAILER_LANG["from_failed"] = 'The following From address failed: '; |
| 17 | +$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' . |
| 18 | + 'recipients failed: '; |
| 19 | +$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.'; |
| 20 | +$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host.'; |
| 21 | +$PHPMAILER_LANG["file_access"] = 'Could not access file: '; |
| 22 | +$PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: '; |
| 23 | +$PHPMAILER_LANG["encoding"] = 'Unknown encoding: '; |
| 24 | +?> |
Property changes on: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/language/phpmailer.lang-en.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 25 | + native |
Index: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/language/phpmailer.lang-ca.php |
— | — | @@ -0,0 +1,22 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * PHPMailer language file. |
| 5 | + * Catalan Version |
| 6 | + * By Ivan: web AT microstudi DOT com |
| 7 | + */ |
| 8 | + |
| 9 | +$PHPMAILER_LANG = array(); |
| 10 | + |
| 11 | +$PHPMAILER_LANG["provide_address"] = 'S\'ha de proveir almenys una adre�a d\'email com a destinatari.'; |
| 12 | +$PHPMAILER_LANG["mailer_not_supported"] = ' mailer no est� suportat'; |
| 13 | +$PHPMAILER_LANG["execute"] = 'No es pot executar: '; |
| 14 | +$PHPMAILER_LANG["instantiate"] = 'No s\'ha pogut crear una inst�ncia de la funci� Mail.'; |
| 15 | +$PHPMAILER_LANG["authenticate"] = 'Error SMTP: No s\'hapogut autenticar.'; |
| 16 | +$PHPMAILER_LANG["from_failed"] = 'La(s) seg�ent(s) adreces de remitent han fallat: '; |
| 17 | +$PHPMAILER_LANG["recipients_failed"] = 'Error SMTP: Els seg�ents destinataris han fallat: '; |
| 18 | +$PHPMAILER_LANG["data_not_accepted"] = 'Error SMTP: Dades no acceptades.'; |
| 19 | +$PHPMAILER_LANG["connect_host"] = 'Error SMTP: No es pot connectar al servidor SMTP.'; |
| 20 | +$PHPMAILER_LANG["file_access"] = 'No es pot accedir a l\'arxiu: '; |
| 21 | +$PHPMAILER_LANG["file_open"] = 'Error d\'Arxiu: No es pot obrir l\'arxiu: '; |
| 22 | +$PHPMAILER_LANG["encoding"] = 'Codificaci� desconeguda: '; |
| 23 | +?> |
\ No newline at end of file |
Property changes on: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/language/phpmailer.lang-ca.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 24 | + native |
Index: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/language/phpmailer.lang-fo.php |
— | — | @@ -0,0 +1,50 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + |
| 6 | + * PHPMailer language file. |
| 7 | + |
| 8 | + * Faroese Version [language of the Faroe Islands, a Danish dominion] |
| 9 | + |
| 10 | + * This file created: 11-06-2004 |
| 11 | + |
| 12 | + * Supplied by D�vur S�rensen [www.profo-webdesign.dk] |
| 13 | + |
| 14 | + */ |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +$PHPMAILER_LANG = array(); |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | +$PHPMAILER_LANG["provide_address"] = 'T� skal uppgeva minst ' . |
| 23 | + |
| 24 | + 'm�ttakara-emailadressu(r).'; |
| 25 | + |
| 26 | +$PHPMAILER_LANG["mailer_not_supported"] = ' er ikki supportera�.'; |
| 27 | + |
| 28 | +$PHPMAILER_LANG["execute"] = 'Kundi ikki �tf�ra: '; |
| 29 | + |
| 30 | +$PHPMAILER_LANG["instantiate"] = 'Kuni ikki instantiera mail funkti�n.'; |
| 31 | + |
| 32 | +$PHPMAILER_LANG["authenticate"] = 'SMTP feilur: Kundi ikki g��kenna.'; |
| 33 | + |
| 34 | +$PHPMAILER_LANG["from_failed"] = 'fylgjandi Fr�/From adressa miseydna�ist: '; |
| 35 | + |
| 36 | +$PHPMAILER_LANG["recipients_failed"] = 'SMTP Feilur: Fylgjandi ' . |
| 37 | + |
| 38 | + 'm�ttakarar miseydna�ust: '; |
| 39 | + |
| 40 | +$PHPMAILER_LANG["data_not_accepted"] = 'SMTP feilur: Data ikki g��kent.'; |
| 41 | + |
| 42 | +$PHPMAILER_LANG["connect_host"] = 'SMTP feilur: Kundi ikki kn�ta samband vi� SMTP vert.'; |
| 43 | + |
| 44 | +$PHPMAILER_LANG["file_access"] = 'Kundi ikki tilganga f�lu: '; |
| 45 | + |
| 46 | +$PHPMAILER_LANG["file_open"] = 'F�lu feilur: Kundi ikki opna f�lu: '; |
| 47 | + |
| 48 | +$PHPMAILER_LANG["encoding"] = '�kend encoding: '; |
| 49 | + |
| 50 | +?> |
| 51 | + |
Property changes on: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/language/phpmailer.lang-fo.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 52 | + native |
Index: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/language/phpmailer.lang-tr.php |
— | — | @@ -0,0 +1,25 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * PHPMailer dil dosyas�. |
| 5 | + * T�rk�e Versiyonu |
| 6 | + * �ZYAZILIM - El�in �zel - Can Y�lmaz - Mehmet Benlio�lu |
| 7 | + */ |
| 8 | + |
| 9 | +$PHPMAILER_LANG = array(); |
| 10 | + |
| 11 | +$PHPMAILER_LANG["provide_address"] = 'En az bir tane mail adresi belirtmek zorundas�n�z ' . |
| 12 | + 'al�c�n�n email adresi.'; |
| 13 | +$PHPMAILER_LANG["mailer_not_supported"] = ' mailler desteklenmemektedir.'; |
| 14 | +$PHPMAILER_LANG["execute"] = '�al��t�r�lam�yor: '; |
| 15 | +$PHPMAILER_LANG["instantiate"] = '�rnek mail fonksiyonu yarat�lamad�.'; |
| 16 | +$PHPMAILER_LANG["authenticate"] = 'SMTP Hatas�: Do�rulanam�yor.'; |
| 17 | +$PHPMAILER_LANG["from_failed"] = 'Ba�ar�s�z olan g�nderici adresi: '; |
| 18 | +$PHPMAILER_LANG["recipients_failed"] = 'SMTP Hatas�: ' . |
| 19 | + 'al�c�lara ula�mad�: '; |
| 20 | +$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Hatas�: Veri kabul edilmedi.'; |
| 21 | +$PHPMAILER_LANG["connect_host"] = 'SMTP Hatas�: SMTP hosta ba�lan�lam�yor.'; |
| 22 | +$PHPMAILER_LANG["file_access"] = 'Dosyaya eri�ilemiyor: '; |
| 23 | +$PHPMAILER_LANG["file_open"] = 'Dosya Hatas�: Dosya a��lam�yor: '; |
| 24 | +$PHPMAILER_LANG["encoding"] = 'Bilinmeyen �ifreleme: '; |
| 25 | + |
| 26 | +?> |
\ No newline at end of file |
Property changes on: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/language/phpmailer.lang-tr.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 27 | + native |
Index: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/language/phpmailer.lang-de.php |
— | — | @@ -0,0 +1,23 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * PHPMailer language file. |
| 5 | + * German Version |
| 6 | + */ |
| 7 | + |
| 8 | +$PHPMAILER_LANG = array(); |
| 9 | + |
| 10 | +$PHPMAILER_LANG["provide_address"] = 'Bitte geben Sie mindestens eine ' . |
| 11 | + 'Empfänger Emailadresse an.'; |
| 12 | +$PHPMAILER_LANG["mailer_not_supported"] = ' mailer wird nicht unterstützt.'; |
| 13 | +$PHPMAILER_LANG["execute"] = 'Konnte folgenden Befehl nicht ausführen: '; |
| 14 | +$PHPMAILER_LANG["instantiate"] = 'Mail Funktion konnte nicht initialisiert werden.'; |
| 15 | +$PHPMAILER_LANG["authenticate"] = 'SMTP Fehler: Authentifizierung fehlgeschlagen.'; |
| 16 | +$PHPMAILER_LANG["from_failed"] = 'Die folgende Absenderadresse ist nicht korrekt: '; |
| 17 | +$PHPMAILER_LANG["recipients_failed"] = 'SMTP Fehler: Die folgenden ' . |
| 18 | + 'Empfänger sind nicht korrekt: '; |
| 19 | +$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Fehler: Daten werden nicht akzeptiert.'; |
| 20 | +$PHPMAILER_LANG["connect_host"] = 'SMTP Fehler: Konnte keine Verbindung zum SMTP-Host herstellen.'; |
| 21 | +$PHPMAILER_LANG["file_access"] = 'Zugriff auf folgende Datei fehlgeschlagen: '; |
| 22 | +$PHPMAILER_LANG["file_open"] = 'Datei Fehler: konnte folgende Datei nicht öffnen: '; |
| 23 | +$PHPMAILER_LANG["encoding"] = 'Unbekanntes Encoding-Format: '; |
| 24 | +?> |
Property changes on: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/language/phpmailer.lang-de.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 25 | + native |
Index: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/language/phpmailer.lang-et.php |
— | — | @@ -0,0 +1,22 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * PHPMailer language file. |
| 5 | + * Estonian Version |
| 6 | + * By Indrek Päri |
| 7 | + */ |
| 8 | + |
| 9 | +$PHPMAILER_LANG = array(); |
| 10 | + |
| 11 | +$PHPMAILER_LANG["provide_address"] = 'Te peate määrama vähemalt ühe saaja e-posti aadressi.'; |
| 12 | +$PHPMAILER_LANG["mailer_not_supported"] = ' maileri tugi puudub.'; |
| 13 | +$PHPMAILER_LANG["execute"] = 'Tegevus ebaõnnestus: '; |
| 14 | +$PHPMAILER_LANG["instantiate"] = 'mail funktiooni käivitamine ebaõnnestus.'; |
| 15 | +$PHPMAILER_LANG["authenticate"] = 'SMTP Viga: Autoriseerimise viga.'; |
| 16 | +$PHPMAILER_LANG["from_failed"] = 'Järgnev saatja e-posti aadress on vigane: '; |
| 17 | +$PHPMAILER_LANG["recipients_failed"] = 'SMTP Viga: Järgnevate saajate e-posti aadressid on vigased: '; |
| 18 | +$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Viga: Vigased andmed.'; |
| 19 | +$PHPMAILER_LANG["connect_host"] = 'SMTP Viga: Ei õnnestunud luua ühendust SMTP serveriga.'; |
| 20 | +$PHPMAILER_LANG["file_access"] = 'Pole piisavalt õiguseid järgneva faili avamiseks: '; |
| 21 | +$PHPMAILER_LANG["file_open"] = 'Faili Viga: Faili avamine ebaõnnestus: '; |
| 22 | +$PHPMAILER_LANG["encoding"] = 'Tundmatu Unknown kodeering: '; |
| 23 | +?> |
Property changes on: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/language/phpmailer.lang-et.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 24 | + native |
Index: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/docs/pop3_article.txt |
— | — | @@ -0,0 +1,39 @@ |
| 2 | +This is built for PHP Mailer 1.72 and was not tested with any previous version. It was developed under PHP 4.3.11 (E_ALL). It works under PHP 5 and 5.1 with E_ALL, but not in Strict mode due to var deprecation (but then neither does PHP Mailer either!). It follows the RFC 1939 standard explicitly and is fully commented. |
| 3 | + |
| 4 | +With that noted, here is how to implement it: |
| 5 | +Install the class file |
| 6 | + |
| 7 | +I didn't want to modify the PHP Mailer classes at all, so you will have to include/require this class along with the base one. It can sit quite happily in the phpmailer-1.72 directory: |
| 8 | +[geshi lang=php] require 'phpmailer-1.72/class.phpmailer.php'; require 'phpmailer-1.72/class.pop3.php'; [/geshi] |
| 9 | +When you need it, create your POP3 object |
| 10 | + |
| 11 | +Right before I invoke PHP Mailer I activate the POP3 authorisation. POP3 before SMTP is a process whereby you login to your web hosts POP3 mail server BEFORE sending out any emails via SMTP. The POP3 logon 'verifies' your ability to send email by SMTP, which typically otherwise blocks you. On my web host (Pair Networks) a single POP3 logon is enough to 'verify' you for 90 minutes. Here is some sample PHP code that activates the POP3 logon and then sends an email via PHP Mailer: |
| 12 | +[geshi lang=php] Authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1); $mail = new PHPMailer(); $mail->SMTPDebug = 2; $mail->IsSMTP(); $mail->IsHTML(false); $mail->Host = 'relay.example.com'; $mail->From = 'mailer@example.com'; $mail->FromName = 'Example Mailer'; $mail->Subject = 'My subject'; $mail->Body = 'Hello world'; $mail->AddAddress('rich@corephp.co.uk', 'Richard Davey'); if (!$mail->Send()) { echo $mail->ErrorInfo; } ?> [/geshi] |
| 13 | + |
| 14 | +The PHP Mailer parts of this code should be obvious to anyone who has used PHP Mailer before. One thing to note - you almost certainly will not need to use SMTP Authentication *and* POP3 before SMTP together. The Authorisation method is a proxy method to all of the others within that class. There are Connect, Logon and Disconnect methods available, but I wrapped them in the single Authorisation one to make things easier. |
| 15 | +The Parameters |
| 16 | + |
| 17 | +The Authorise parameters are as follows: |
| 18 | +[geshi lang=php]$pop->Authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1);[/geshi] |
| 19 | + |
| 20 | + 1. pop3.example.com - The POP3 Mail Server Name (hostname or IP address) |
| 21 | + 2. 110 - The POP3 Port on which to connect (default is usually 110, but check with your host) |
| 22 | + 3. 30 - A connection time-out value (in seconds) |
| 23 | + 4. mailer - The POP3 Username required to logon |
| 24 | + 5. password - The POP3 Password required to logon |
| 25 | + 6. 1 - The class debug level (0 = off, 1+ = debug output is echoed to the browser) |
| 26 | + |
| 27 | +Final Comments + the Download |
| 28 | + |
| 29 | +1) This class does not support APOP connections. This is only because I did not have an APOP server to test with, but if you'd like to see that added just contact me. |
| 30 | + |
| 31 | +2) Opening and closing lots of POP3 connections can be quite a resource/network drain. If you need to send a whole batch of emails then just perform the authentication once at the start, and then loop through your mail sending script. Providing this process doesn't take longer than the verification period lasts on your POP3 server, you should be fine. With my host that period is 90 minutes, i.e. plenty of time. |
| 32 | + |
| 33 | +3) If you have heavy requirements for this script (i.e. send a LOT of email on a frequent basis) then I would advise seeking out an alternative sending method (direct SMTP ideally). If this isn't possible then you could modify this class so the 'last authorised' date is recorded somewhere (MySQL, Flat file, etc) meaning you only open a new connection if the old one has expired, saving you precious overhead. |
| 34 | + |
| 35 | +4) There are lots of other POP3 classes for PHP available. However most of them implement the full POP3 command set, where-as this one is purely for authentication, and much lighter as a result. However using any of the other POP3 classes to just logon to your server would have the same net result. At the end of the day, use whatever method you feel most comfortable with. |
| 36 | +Download |
| 37 | + |
| 38 | +Here is the full class file plus my test script: POP_before_SMTP_PHPMailer.zip (4 KB) - Please note that it does not include PHPMailer itself. |
| 39 | + |
| 40 | +My thanks to Chris Ryan for the inspiration (even if indirectly, via his SMTP class) |
Property changes on: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/docs/pop3_article.txt |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 41 | + native |
Index: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/docs/use_gmail.txt |
— | — | @@ -0,0 +1,40 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +// example on using PHPMailer with GMAIL |
| 5 | + |
| 6 | +include("class.phpmailer.php"); |
| 7 | +include("class.smtp.php"); |
| 8 | + |
| 9 | +$mail=new PHPMailer(); |
| 10 | + |
| 11 | +$mail->IsSMTP(); |
| 12 | +$mail->SMTPAuth = true; // enable SMTP authentication |
| 13 | +$mail->SMTPSecure = "ssl"; // sets the prefix to the servier |
| 14 | +$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server |
| 15 | +$mail->Port = 465; // set the SMTP port |
| 16 | + |
| 17 | +$mail->Username = "yourname@gmail.com"; // GMAIL username |
| 18 | +$mail->Password = "password"; // GMAIL password |
| 19 | + |
| 20 | +$mail->From = "replyto@yourdomain.com"; |
| 21 | +$mail->FromName = "Webmaster"; |
| 22 | +$mail->Subject = "This is the subject"; |
| 23 | +$mail->Body = "Hi,<br>This is the HTML BODY<br>"; //HTML Body |
| 24 | +$mail->AltBody = "This is the body when user views in plain text format"; //Text Body |
| 25 | + |
| 26 | +$mail->WordWrap = 50; // set word wrap |
| 27 | + |
| 28 | +$mail->AddAddress("username@domain.com","First Last"); |
| 29 | +$mail->AddReplyTo("replyto@yourdomain.com","Webmaster"); |
| 30 | +$mail->AddAttachment("/path/to/file.zip"); // attachment |
| 31 | +$mail->AddAttachment("/path/to/image.jpg", "new.jpg"); // attachment |
| 32 | + |
| 33 | +$mail->IsHTML(true); // send as HTML |
| 34 | + |
| 35 | +if(!$mail->Send()) { |
| 36 | + echo "Mailer Error: " . $mail->ErrorInfo; |
| 37 | +} else { |
| 38 | + echo "Message has been sent"; |
| 39 | +} |
| 40 | + |
| 41 | +?> |
Property changes on: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/docs/use_gmail.txt |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 42 | + native |
Index: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/docs/extending.html |
— | — | @@ -0,0 +1,148 @@ |
| 2 | +<html> |
| 3 | +<head> |
| 4 | +<title>Examples using phpmailer</title> |
| 5 | +</head> |
| 6 | + |
| 7 | +<body bgcolor="#FFFFFF"> |
| 8 | + |
| 9 | +<h2>Examples using phpmailer</h2> |
| 10 | + |
| 11 | +<h3>1. Advanced Example</h3> |
| 12 | +<p> |
| 13 | + |
| 14 | +This demonstrates sending out multiple email messages with binary attachments |
| 15 | +from a MySQL database with multipart/alternative support.<p> |
| 16 | +<table cellpadding="4" border="1" width="80%"> |
| 17 | +<tr> |
| 18 | +<td bgcolor="#CCCCCC"> |
| 19 | +<pre> |
| 20 | +require("class.phpmailer.php"); |
| 21 | + |
| 22 | +$mail = new phpmailer(); |
| 23 | + |
| 24 | +$mail->From = "list@example.com"; |
| 25 | +$mail->FromName = "List manager"; |
| 26 | +$mail->Host = "smtp1.example.com;smtp2.example.com"; |
| 27 | +$mail->Mailer = "smtp"; |
| 28 | + |
| 29 | +@MYSQL_CONNECT("localhost","root","password"); |
| 30 | +@mysql_select_db("my_company"); |
| 31 | +$query� =�"SELECT full_name, email,�photo�FROM employee�WHERE�id=$id"; |
| 32 | +$result�=�@MYSQL_QUERY($query); |
| 33 | + |
| 34 | +while ($row = mysql_fetch_array ($result)) |
| 35 | +{ |
| 36 | + // HTML body |
| 37 | + $body = "Hello <font size=\"4\">" . $row["full_name"] . "</font>, <p>"; |
| 38 | + $body .= "<i>Your</i> personal photograph to this message.<p>"; |
| 39 | + $body .= "Sincerely, <br>"; |
| 40 | + $body .= "phpmailer List manager"; |
| 41 | + |
| 42 | + // Plain text body (for mail clients that cannot read HTML) |
| 43 | + $text_body = "Hello " . $row["full_name"] . ", \n\n"; |
| 44 | + $text_body .= "Your personal photograph to this message.\n\n"; |
| 45 | + $text_body .= "Sincerely, \n"; |
| 46 | + $text_body .= "phpmailer List manager"; |
| 47 | + |
| 48 | + $mail->Body = $body; |
| 49 | + $mail->AltBody = $text_body; |
| 50 | + $mail->AddAddress($row["email"], $row["full_name"]); |
| 51 | + $mail->AddStringAttachment($row["photo"], "YourPhoto.jpg"); |
| 52 | + |
| 53 | + if(!$mail->Send()) |
| 54 | + echo "There has been a mail error sending to " . $row["email"] . "<br>"; |
| 55 | + |
| 56 | + // Clear all addresses and attachments for next loop |
| 57 | + $mail->ClearAddresses(); |
| 58 | + $mail->ClearAttachments(); |
| 59 | +} |
| 60 | +</pre> |
| 61 | +</td> |
| 62 | +</tr> |
| 63 | +</table> |
| 64 | +<p> |
| 65 | + |
| 66 | +<h3>2. Extending phpmailer</h3> |
| 67 | +<p> |
| 68 | + |
| 69 | +Extending classes with inheritance is one of the most |
| 70 | +powerful features of object-oriented |
| 71 | +programming. It allows you to make changes to the |
| 72 | +original class for your |
| 73 | +own personal use without hacking the original |
| 74 | +classes. Plus, it is very |
| 75 | +easy to do. I've provided an example: |
| 76 | + |
| 77 | +<p> |
| 78 | +Here's a class that extends the phpmailer class and sets the defaults |
| 79 | +for the particular site:<br> |
| 80 | +PHP include file: <b>mail.inc.php</b> |
| 81 | +<p> |
| 82 | + |
| 83 | +<table cellpadding="4" border="1" width="80%"> |
| 84 | +<tr> |
| 85 | +<td bgcolor="#CCCCCC"> |
| 86 | +<pre> |
| 87 | +require("class.phpmailer.php"); |
| 88 | + |
| 89 | +class my_phpmailer extends phpmailer { |
| 90 | + // Set default variables for all new objects |
| 91 | + var $From = "from@example.com"; |
| 92 | + var $FromName = "Mailer"; |
| 93 | + var $Host = "smtp1.example.com;smtp2.example.com"; |
| 94 | + var $Mailer = "smtp"; // Alternative to IsSMTP() |
| 95 | + var $WordWrap = 75; |
| 96 | + |
| 97 | + // Replace the default error_handler |
| 98 | + function error_handler($msg) { |
| 99 | + print("My Site Error"); |
| 100 | + print("Description:"); |
| 101 | + printf("%s", $msg); |
| 102 | + exit; |
| 103 | + } |
| 104 | + |
| 105 | + // Create an additional function |
| 106 | + function do_something($something) { |
| 107 | + // Place your new code here |
| 108 | + } |
| 109 | +} |
| 110 | +</td> |
| 111 | +</tr> |
| 112 | +</table> |
| 113 | +<br> |
| 114 | + |
| 115 | +Now here's a normal PHP page in the site, which will have all the defaults set |
| 116 | +above:<br> |
| 117 | +Normal PHP file: <b>mail_test.php</b> |
| 118 | +<p> |
| 119 | + |
| 120 | +<table cellpadding="4" border="1" width="80%"> |
| 121 | +<tr> |
| 122 | +<td bgcolor="#CCCCCC"> |
| 123 | +<pre> |
| 124 | +require("mail.inc.php"); |
| 125 | + |
| 126 | +// Instantiate your new class |
| 127 | +$mail = new my_phpmailer; |
| 128 | + |
| 129 | +// Now you only need to add the necessary stuff |
| 130 | +$mail->AddAddress("josh@example.com", "Josh Adams"); |
| 131 | +$mail->Subject = "Here is the subject"; |
| 132 | +$mail->Body = "This is the message body"; |
| 133 | +$mail->AddAttachment("c:/temp/11-10-00.zip", "new_name.zip"); // optional name |
| 134 | + |
| 135 | +if(!$mail->Send()) |
| 136 | +{ |
| 137 | + echo "There was an error sending the message"; |
| 138 | + exit; |
| 139 | +} |
| 140 | + |
| 141 | +echo "Message was sent successfully"; |
| 142 | +</pre> |
| 143 | +</td> |
| 144 | +</tr> |
| 145 | +</table> |
| 146 | +</p> |
| 147 | + |
| 148 | +</body> |
| 149 | +</html> |
Property changes on: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/docs/extending.html |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 150 | + native |
Index: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/docs/faq.html |
— | — | @@ -0,0 +1,66 @@ |
| 2 | +<html> |
| 3 | +<head> |
| 4 | +<title>phpmailer FAQ</title> |
| 5 | +</head> |
| 6 | + |
| 7 | +<body bgcolor="#FFFFFF"> |
| 8 | + |
| 9 | +<h2>phpmailer FAQ</h2> |
| 10 | + |
| 11 | +<p> |
| 12 | +<b>I'm using the SMTP mailer and I keep on getting a timeout message |
| 13 | +well before the X seconds I set it for. What gives?</b> |
| 14 | +<br> |
| 15 | +PHP versions 4.0.4pl1 and earlier have a bug in which sockets timeout |
| 16 | +early. You can fix this by re-compiling PHP 4.0.4pl1 with this fix: |
| 17 | +<a href="timeoutfix.diff">timeoutfix.diff</a>. Otherwise you can wait |
| 18 | +for the new PHP release. |
| 19 | +</p> |
| 20 | + |
| 21 | +<p> |
| 22 | +<b>I am concerned that using include files will take up too much |
| 23 | +processing time on my computer. How can I make it run faster?</b> |
| 24 | +<br> |
| 25 | +PHP by itself is very fast. Much faster than ASP or JSP running on |
| 26 | +the same type of server. This is because it has very little overhead compared |
| 27 | +to its competitors and it pre-compiles all of |
| 28 | +its code before it runs each script (in PHP4). However, all of |
| 29 | +this compiling and re-compiling can take up a lot of valuable |
| 30 | +computer resources. However, there are programs out there that compile |
| 31 | +PHP code and store it in memory (or on mmaped files) to reduce the |
| 32 | +processing immensely. Two of these: <a href="http://apc.communityconnect.com">APC |
| 33 | +(Alternative PHP Cache)</a> and <a href="http://bwcache.bware.it/index.htm">Afterburner</a> |
| 34 | +(<a href="http://www.mm4.de/php4win/mod_php4_win32/">Win32 download</a>) |
| 35 | +are excellent free tools that do just this. If you have the money |
| 36 | +you might also try <a href="http://www.zend.com">Zend Cache</a>, it is |
| 37 | +even faster than the open source varieties. All of these tools make your |
| 38 | +scripts run faster while also reducing the load on your server. I have tried |
| 39 | +them myself and they are quite stable too. |
| 40 | +</p> |
| 41 | + |
| 42 | + |
| 43 | +<p> |
| 44 | +<b>What mailer gives me the best performance?</b> |
| 45 | +<br> |
| 46 | +On a single machine the mail() or sendmail mailers give you the best |
| 47 | +performance because they do not have the added overhead of SMTP. |
| 48 | +If you have you have your mail server on a another machine then |
| 49 | +SMTP is your only option, but you do get the benefit of redundant |
| 50 | +mail servers. |
| 51 | +</p> |
| 52 | + |
| 53 | +<p> |
| 54 | +<b>When I try to attach a file with on my server I get a |
| 55 | +"Could not find {file} on filesystem error". Why is this?</b> |
| 56 | +<br> |
| 57 | +If you are using a Unix machine this is probably because the user |
| 58 | +running your web server does not have read access to the directory |
| 59 | +in question. If you are using Windows, then the problem probably is |
| 60 | +that you have used single backslashes to denote directories ("\"). |
| 61 | +A single backslash has a special meaning to PHP so these are not |
| 62 | +valid. Instead use double backslashes ("\\") or a single forward |
| 63 | +slash ("/"). |
| 64 | +</p> |
| 65 | + |
| 66 | +</body> |
| 67 | +</html> |
\ No newline at end of file |
Property changes on: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/docs/faq.html |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 68 | + native |
Index: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/class.phpmailer.php |
— | — | @@ -0,0 +1,1667 @@ |
| 2 | +<?php |
| 3 | +/*~ class.phpmailer.php |
| 4 | +.---------------------------------------------------------------------------. |
| 5 | +| Software: PHPMailer - PHP email class | |
| 6 | +| Version: 2.0.0 rc1 | |
| 7 | +| Contact: via sourceforge.net support pages (also www.codeworxtech.com) | |
| 8 | +| Info: http://phpmailer.sourceforge.net | |
| 9 | +| Support: http://sourceforge.net/projects/phpmailer/ | |
| 10 | +| ------------------------------------------------------------------------- | |
| 11 | +| Author: Andy Prevost (project admininistrator) | |
| 12 | +| Author: Brent R. Matzelle (original founder) | |
| 13 | +| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. | |
| 14 | +| Copyright (c) 2001-2003, Brent R. Matzelle | |
| 15 | +| ------------------------------------------------------------------------- | |
| 16 | +| License: Distributed under the Lesser General Public License (LGPL) | |
| 17 | +| http://www.gnu.org/copyleft/lesser.html | |
| 18 | +| This program is distributed in the hope that it will be useful - WITHOUT | |
| 19 | +| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 20 | +| FITNESS FOR A PARTICULAR PURPOSE. | |
| 21 | +| ------------------------------------------------------------------------- | |
| 22 | +| We offer a number of paid services (www.codeworxtech.com): | |
| 23 | +| - Web Hosting on highly optimized fast and secure servers | |
| 24 | +| - Technology Consulting | |
| 25 | +| - Oursourcing (highly qualified programmers and graphic designers) | |
| 26 | +'---------------------------------------------------------------------------' |
| 27 | + |
| 28 | +/** |
| 29 | + * PHPMailer - PHP email transport class |
| 30 | + * @package PHPMailer |
| 31 | + * @author Andy Prevost |
| 32 | + * @copyright 2004 - 2007 Andy Prevost |
| 33 | + */ |
| 34 | + |
| 35 | +class PHPMailer { |
| 36 | + |
| 37 | + ///////////////////////////////////////////////// |
| 38 | + // PROPERTIES, PUBLIC |
| 39 | + ///////////////////////////////////////////////// |
| 40 | + |
| 41 | + /** |
| 42 | + * Email priority (1 = High, 3 = Normal, 5 = low). |
| 43 | + * @var int |
| 44 | + */ |
| 45 | + public $Priority = 3; |
| 46 | + |
| 47 | + /** |
| 48 | + * Sets the CharSet of the message. |
| 49 | + * @var string |
| 50 | + */ |
| 51 | + public $CharSet = 'iso-8859-1'; |
| 52 | + |
| 53 | + /** |
| 54 | + * Sets the Content-type of the message. |
| 55 | + * @var string |
| 56 | + */ |
| 57 | + public $ContentType = 'text/plain'; |
| 58 | + |
| 59 | + /** |
| 60 | + * Sets the Encoding of the message. Options for this are "8bit", |
| 61 | + * "7bit", "binary", "base64", and "quoted-printable". |
| 62 | + * @var string |
| 63 | + */ |
| 64 | + public $Encoding = '8bit'; |
| 65 | + |
| 66 | + /** |
| 67 | + * Holds the most recent mailer error message. |
| 68 | + * @var string |
| 69 | + */ |
| 70 | + public $ErrorInfo = ''; |
| 71 | + |
| 72 | + /** |
| 73 | + * Sets the From email address for the message. |
| 74 | + * @var string |
| 75 | + */ |
| 76 | + public $From = 'root@localhost'; |
| 77 | + |
| 78 | + /** |
| 79 | + * Sets the From name of the message. |
| 80 | + * @var string |
| 81 | + */ |
| 82 | + public $FromName = 'Root User'; |
| 83 | + |
| 84 | + /** |
| 85 | + * Sets the Sender email (Return-Path) of the message. If not empty, |
| 86 | + * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode. |
| 87 | + * @var string |
| 88 | + */ |
| 89 | + public $Sender = ''; |
| 90 | + |
| 91 | + /** |
| 92 | + * Sets the Subject of the message. |
| 93 | + * @var string |
| 94 | + */ |
| 95 | + public $Subject = ''; |
| 96 | + |
| 97 | + /** |
| 98 | + * Sets the Body of the message. This can be either an HTML or text body. |
| 99 | + * If HTML then run IsHTML(true). |
| 100 | + * @var string |
| 101 | + */ |
| 102 | + public $Body = ''; |
| 103 | + |
| 104 | + /** |
| 105 | + * Sets the text-only body of the message. This automatically sets the |
| 106 | + * email to multipart/alternative. This body can be read by mail |
| 107 | + * clients that do not have HTML email capability such as mutt. Clients |
| 108 | + * that can read HTML will view the normal Body. |
| 109 | + * @var string |
| 110 | + */ |
| 111 | + public $AltBody = ''; |
| 112 | + |
| 113 | + /** |
| 114 | + * Sets word wrapping on the body of the message to a given number of |
| 115 | + * characters. |
| 116 | + * @var int |
| 117 | + */ |
| 118 | + public $WordWrap = 0; |
| 119 | + |
| 120 | + /** |
| 121 | + * Method to send mail: ("mail", "sendmail", or "smtp"). |
| 122 | + * @var string |
| 123 | + */ |
| 124 | + public $Mailer = 'mail'; |
| 125 | + |
| 126 | + /** |
| 127 | + * Sets the path of the sendmail program. |
| 128 | + * @var string |
| 129 | + */ |
| 130 | + public $Sendmail = '/usr/sbin/sendmail'; |
| 131 | + |
| 132 | + /** |
| 133 | + * Path to PHPMailer plugins. This is now only useful if the SMTP class |
| 134 | + * is in a different directory than the PHP include path. |
| 135 | + * @var string |
| 136 | + */ |
| 137 | + public $PluginDir = ''; |
| 138 | + |
| 139 | + /** |
| 140 | + * Holds PHPMailer version. |
| 141 | + * @var string |
| 142 | + */ |
| 143 | + public $Version = "2.0.0 rc1"; |
| 144 | + |
| 145 | + /** |
| 146 | + * Sets the email address that a reading confirmation will be sent. |
| 147 | + * @var string |
| 148 | + */ |
| 149 | + public $ConfirmReadingTo = ''; |
| 150 | + |
| 151 | + /** |
| 152 | + * Sets the hostname to use in Message-Id and Received headers |
| 153 | + * and as default HELO string. If empty, the value returned |
| 154 | + * by SERVER_NAME is used or 'localhost.localdomain'. |
| 155 | + * @var string |
| 156 | + */ |
| 157 | + public $Hostname = ''; |
| 158 | + |
| 159 | + ///////////////////////////////////////////////// |
| 160 | + // PROPERTIES FOR SMTP |
| 161 | + ///////////////////////////////////////////////// |
| 162 | + |
| 163 | + /** |
| 164 | + * Sets the SMTP hosts. All hosts must be separated by a |
| 165 | + * semicolon. You can also specify a different port |
| 166 | + * for each host by using this format: [hostname:port] |
| 167 | + * (e.g. "smtp1.example.com:25;smtp2.example.com"). |
| 168 | + * Hosts will be tried in order. |
| 169 | + * @var string |
| 170 | + */ |
| 171 | + public $Host = 'localhost'; |
| 172 | + |
| 173 | + /** |
| 174 | + * Sets the default SMTP server port. |
| 175 | + * @var int |
| 176 | + */ |
| 177 | + public $Port = 25; |
| 178 | + |
| 179 | + /** |
| 180 | + * Sets the SMTP HELO of the message (Default is $Hostname). |
| 181 | + * @var string |
| 182 | + */ |
| 183 | + public $Helo = ''; |
| 184 | + |
| 185 | + /** |
| 186 | + * Sets connection prefix. |
| 187 | + * Options are "", "ssl" or "tls" |
| 188 | + * @var string |
| 189 | + */ |
| 190 | + public $SMTPSecure = ""; |
| 191 | + |
| 192 | + /** |
| 193 | + * Sets SMTP authentication. Utilizes the Username and Password variables. |
| 194 | + * @var bool |
| 195 | + */ |
| 196 | + public $SMTPAuth = false; |
| 197 | + |
| 198 | + /** |
| 199 | + * Sets SMTP username. |
| 200 | + * @var string |
| 201 | + */ |
| 202 | + public $Username = ''; |
| 203 | + |
| 204 | + /** |
| 205 | + * Sets SMTP password. |
| 206 | + * @var string |
| 207 | + */ |
| 208 | + public $Password = ''; |
| 209 | + |
| 210 | + /** |
| 211 | + * Sets the SMTP server timeout in seconds. This function will not |
| 212 | + * work with the win32 version. |
| 213 | + * @var int |
| 214 | + */ |
| 215 | + public $Timeout = 10; |
| 216 | + |
| 217 | + /** |
| 218 | + * Sets SMTP class debugging on or off. |
| 219 | + * @var bool |
| 220 | + */ |
| 221 | + public $SMTPDebug = false; |
| 222 | + |
| 223 | + /** |
| 224 | + * Prevents the SMTP connection from being closed after each mail |
| 225 | + * sending. If this is set to true then to close the connection |
| 226 | + * requires an explicit call to SmtpClose(). |
| 227 | + * @var bool |
| 228 | + */ |
| 229 | + public $SMTPKeepAlive = false; |
| 230 | + |
| 231 | + /** |
| 232 | + * Provides the ability to have the TO field process individual |
| 233 | + * emails, instead of sending to entire TO addresses |
| 234 | + * @var bool |
| 235 | + */ |
| 236 | + public $SingleTo = false; |
| 237 | + |
| 238 | + ///////////////////////////////////////////////// |
| 239 | + // PROPERTIES, PRIVATE |
| 240 | + ///////////////////////////////////////////////// |
| 241 | + |
| 242 | + private $smtp = NULL; |
| 243 | + private $to = array(); |
| 244 | + private $cc = array(); |
| 245 | + private $bcc = array(); |
| 246 | + private $ReplyTo = array(); |
| 247 | + private $attachment = array(); |
| 248 | + private $CustomHeader = array(); |
| 249 | + private $message_type = ''; |
| 250 | + private $boundary = array(); |
| 251 | + private $language = array(); |
| 252 | + private $error_count = 0; |
| 253 | + private $LE = "\n"; |
| 254 | + |
| 255 | + ///////////////////////////////////////////////// |
| 256 | + // METHODS, VARIABLES |
| 257 | + ///////////////////////////////////////////////// |
| 258 | + |
| 259 | + /** |
| 260 | + * Sets message type to HTML. |
| 261 | + * @param bool $bool |
| 262 | + * @return void |
| 263 | + */ |
| 264 | + function IsHTML($bool) { |
| 265 | + if($bool == true) { |
| 266 | + $this->ContentType = 'text/html'; |
| 267 | + } else { |
| 268 | + $this->ContentType = 'text/plain'; |
| 269 | + } |
| 270 | + } |
| 271 | + |
| 272 | + /** |
| 273 | + * Sets Mailer to send message using SMTP. |
| 274 | + * @return void |
| 275 | + */ |
| 276 | + function IsSMTP() { |
| 277 | + $this->Mailer = 'smtp'; |
| 278 | + } |
| 279 | + |
| 280 | + /** |
| 281 | + * Sets Mailer to send message using PHP mail() function. |
| 282 | + * @return void |
| 283 | + */ |
| 284 | + function IsMail() { |
| 285 | + $this->Mailer = 'mail'; |
| 286 | + } |
| 287 | + |
| 288 | + /** |
| 289 | + * Sets Mailer to send message using the $Sendmail program. |
| 290 | + * @return void |
| 291 | + */ |
| 292 | + function IsSendmail() { |
| 293 | + $this->Mailer = 'sendmail'; |
| 294 | + } |
| 295 | + |
| 296 | + /** |
| 297 | + * Sets Mailer to send message using the qmail MTA. |
| 298 | + * @return void |
| 299 | + */ |
| 300 | + function IsQmail() { |
| 301 | + $this->Sendmail = '/var/qmail/bin/sendmail'; |
| 302 | + $this->Mailer = 'sendmail'; |
| 303 | + } |
| 304 | + |
| 305 | + ///////////////////////////////////////////////// |
| 306 | + // METHODS, RECIPIENTS |
| 307 | + ///////////////////////////////////////////////// |
| 308 | + |
| 309 | + /** |
| 310 | + * Adds a "To" address. |
| 311 | + * @param string $address |
| 312 | + * @param string $name |
| 313 | + * @return void |
| 314 | + */ |
| 315 | + function AddAddress($address, $name = '') { |
| 316 | + $cur = count($this->to); |
| 317 | + $this->to[$cur][0] = trim($address); |
| 318 | + $this->to[$cur][1] = $name; |
| 319 | + } |
| 320 | + |
| 321 | + /** |
| 322 | + * Adds a "Cc" address. Note: this function works |
| 323 | + * with the SMTP mailer on win32, not with the "mail" |
| 324 | + * mailer. |
| 325 | + * @param string $address |
| 326 | + * @param string $name |
| 327 | + * @return void |
| 328 | + */ |
| 329 | + function AddCC($address, $name = '') { |
| 330 | + $cur = count($this->cc); |
| 331 | + $this->cc[$cur][0] = trim($address); |
| 332 | + $this->cc[$cur][1] = $name; |
| 333 | + } |
| 334 | + |
| 335 | + /** |
| 336 | + * Adds a "Bcc" address. Note: this function works |
| 337 | + * with the SMTP mailer on win32, not with the "mail" |
| 338 | + * mailer. |
| 339 | + * @param string $address |
| 340 | + * @param string $name |
| 341 | + * @return void |
| 342 | + */ |
| 343 | + function AddBCC($address, $name = '') { |
| 344 | + $cur = count($this->bcc); |
| 345 | + $this->bcc[$cur][0] = trim($address); |
| 346 | + $this->bcc[$cur][1] = $name; |
| 347 | + } |
| 348 | + |
| 349 | + /** |
| 350 | + * Adds a "Reply-to" address. |
| 351 | + * @param string $address |
| 352 | + * @param string $name |
| 353 | + * @return void |
| 354 | + */ |
| 355 | + function AddReplyTo($address, $name = '') { |
| 356 | + $cur = count($this->ReplyTo); |
| 357 | + $this->ReplyTo[$cur][0] = trim($address); |
| 358 | + $this->ReplyTo[$cur][1] = $name; |
| 359 | + } |
| 360 | + |
| 361 | + ///////////////////////////////////////////////// |
| 362 | + // METHODS, MAIL SENDING |
| 363 | + ///////////////////////////////////////////////// |
| 364 | + |
| 365 | + /** |
| 366 | + * Creates message and assigns Mailer. If the message is |
| 367 | + * not sent successfully then it returns false. Use the ErrorInfo |
| 368 | + * variable to view description of the error. |
| 369 | + * @return bool |
| 370 | + */ |
| 371 | + function Send() { |
| 372 | + $header = ''; |
| 373 | + $body = ''; |
| 374 | + $result = true; |
| 375 | + |
| 376 | + if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) { |
| 377 | + $this->SetError($this->Lang('provide_address')); |
| 378 | + return false; |
| 379 | + } |
| 380 | + |
| 381 | + /* Set whether the message is multipart/alternative */ |
| 382 | + if(!empty($this->AltBody)) { |
| 383 | + $this->ContentType = 'multipart/alternative'; |
| 384 | + } |
| 385 | + |
| 386 | + $this->error_count = 0; // reset errors |
| 387 | + $this->SetMessageType(); |
| 388 | + $header .= $this->CreateHeader(); |
| 389 | + $body = $this->CreateBody(); |
| 390 | + |
| 391 | + if($body == '') { |
| 392 | + return false; |
| 393 | + } |
| 394 | + |
| 395 | + /* Choose the mailer */ |
| 396 | + switch($this->Mailer) { |
| 397 | + case 'sendmail': |
| 398 | + $result = $this->SendmailSend($header, $body); |
| 399 | + break; |
| 400 | + case 'smtp': |
| 401 | + $result = $this->SmtpSend($header, $body); |
| 402 | + break; |
| 403 | + case 'mail': |
| 404 | + $result = $this->MailSend($header, $body); |
| 405 | + break; |
| 406 | + default: |
| 407 | + $result = $this->MailSend($header, $body); |
| 408 | + break; |
| 409 | + //$this->SetError($this->Mailer . $this->Lang('mailer_not_supported')); |
| 410 | + //$result = false; |
| 411 | + //break; |
| 412 | + } |
| 413 | + |
| 414 | + return $result; |
| 415 | + } |
| 416 | + |
| 417 | + /** |
| 418 | + * Sends mail using the $Sendmail program. |
| 419 | + * @access private |
| 420 | + * @return bool |
| 421 | + */ |
| 422 | + function SendmailSend($header, $body) { |
| 423 | + if ($this->Sender != '') { |
| 424 | + $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender)); |
| 425 | + } else { |
| 426 | + $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail)); |
| 427 | + } |
| 428 | + |
| 429 | + if(!@$mail = popen($sendmail, 'w')) { |
| 430 | + $this->SetError($this->Lang('execute') . $this->Sendmail); |
| 431 | + return false; |
| 432 | + } |
| 433 | + |
| 434 | + fputs($mail, $header); |
| 435 | + fputs($mail, $body); |
| 436 | + |
| 437 | + $result = pclose($mail) >> 8 & 0xFF; |
| 438 | + if($result != 0) { |
| 439 | + $this->SetError($this->Lang('execute') . $this->Sendmail); |
| 440 | + return false; |
| 441 | + } |
| 442 | + |
| 443 | + return true; |
| 444 | + } |
| 445 | + |
| 446 | + /** |
| 447 | + * Sends mail using the PHP mail() function. |
| 448 | + * @access private |
| 449 | + * @return bool |
| 450 | + */ |
| 451 | + function MailSend($header, $body) { |
| 452 | + |
| 453 | + $to = ''; |
| 454 | + for($i = 0; $i < count($this->to); $i++) { |
| 455 | + if($i != 0) { $to .= ', '; } |
| 456 | + $to .= $this->AddrFormat($this->to[$i]); |
| 457 | + } |
| 458 | + |
| 459 | + $toArr = split(',', $to); |
| 460 | + |
| 461 | + if ($this->Sender != '' && strlen(ini_get('safe_mode'))< 1) { |
| 462 | + $old_from = ini_get('sendmail_from'); |
| 463 | + ini_set('sendmail_from', $this->Sender); |
| 464 | + $params = sprintf("-oi -f %s", $this->Sender); |
| 465 | + if ($this->SingleTo === true && count($toArr) > 1) { |
| 466 | + foreach ($toArr as $key => $val) { |
| 467 | + $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); |
| 468 | + } |
| 469 | + } else { |
| 470 | + $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); |
| 471 | + } |
| 472 | + } else { |
| 473 | + if ($this->SingleTo === true && count($toArr) > 1) { |
| 474 | + foreach ($toArr as $key => $val) { |
| 475 | + $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); |
| 476 | + } |
| 477 | + } else { |
| 478 | + $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header); |
| 479 | + } |
| 480 | + } |
| 481 | + |
| 482 | + if (isset($old_from)) { |
| 483 | + ini_set('sendmail_from', $old_from); |
| 484 | + } |
| 485 | + |
| 486 | + if(!$rt) { |
| 487 | + $this->SetError($this->Lang('instantiate')); |
| 488 | + return false; |
| 489 | + } |
| 490 | + |
| 491 | + return true; |
| 492 | + } |
| 493 | + |
| 494 | + /** |
| 495 | + * Sends mail via SMTP using PhpSMTP (Author: |
| 496 | + * Chris Ryan). Returns bool. Returns false if there is a |
| 497 | + * bad MAIL FROM, RCPT, or DATA input. |
| 498 | + * @access private |
| 499 | + * @return bool |
| 500 | + */ |
| 501 | + function SmtpSend($header, $body) { |
| 502 | + include_once($this->PluginDir . 'class.smtp.php'); |
| 503 | + $error = ''; |
| 504 | + $bad_rcpt = array(); |
| 505 | + |
| 506 | + if(!$this->SmtpConnect()) { |
| 507 | + return false; |
| 508 | + } |
| 509 | + |
| 510 | + $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender; |
| 511 | + if(!$this->smtp->Mail($smtp_from)) { |
| 512 | + $error = $this->Lang('from_failed') . $smtp_from; |
| 513 | + $this->SetError($error); |
| 514 | + $this->smtp->Reset(); |
| 515 | + return false; |
| 516 | + } |
| 517 | + |
| 518 | + /* Attempt to send attach all recipients */ |
| 519 | + for($i = 0; $i < count($this->to); $i++) { |
| 520 | + if(!$this->smtp->Recipient($this->to[$i][0])) { |
| 521 | + $bad_rcpt[] = $this->to[$i][0]; |
| 522 | + } |
| 523 | + } |
| 524 | + for($i = 0; $i < count($this->cc); $i++) { |
| 525 | + if(!$this->smtp->Recipient($this->cc[$i][0])) { |
| 526 | + $bad_rcpt[] = $this->cc[$i][0]; |
| 527 | + } |
| 528 | + } |
| 529 | + for($i = 0; $i < count($this->bcc); $i++) { |
| 530 | + if(!$this->smtp->Recipient($this->bcc[$i][0])) { |
| 531 | + $bad_rcpt[] = $this->bcc[$i][0]; |
| 532 | + } |
| 533 | + } |
| 534 | + |
| 535 | + if(count($bad_rcpt) > 0) { // Create error message |
| 536 | + for($i = 0; $i < count($bad_rcpt); $i++) { |
| 537 | + if($i != 0) { |
| 538 | + $error .= ', '; |
| 539 | + } |
| 540 | + $error .= $bad_rcpt[$i]; |
| 541 | + } |
| 542 | + $error = $this->Lang('recipients_failed') . $error; |
| 543 | + $this->SetError($error); |
| 544 | + $this->smtp->Reset(); |
| 545 | + return false; |
| 546 | + } |
| 547 | + |
| 548 | + if(!$this->smtp->Data($header . $body)) { |
| 549 | + $this->SetError($this->Lang('data_not_accepted')); |
| 550 | + $this->smtp->Reset(); |
| 551 | + return false; |
| 552 | + } |
| 553 | + if($this->SMTPKeepAlive == true) { |
| 554 | + $this->smtp->Reset(); |
| 555 | + } else { |
| 556 | + $this->SmtpClose(); |
| 557 | + } |
| 558 | + |
| 559 | + return true; |
| 560 | + } |
| 561 | + |
| 562 | + /** |
| 563 | + * Initiates a connection to an SMTP server. Returns false if the |
| 564 | + * operation failed. |
| 565 | + * @access private |
| 566 | + * @return bool |
| 567 | + */ |
| 568 | + function SmtpConnect() { |
| 569 | + if($this->smtp == NULL) { |
| 570 | + $this->smtp = new SMTP(); |
| 571 | + } |
| 572 | + |
| 573 | + $this->smtp->do_debug = $this->SMTPDebug; |
| 574 | + $hosts = explode(';', $this->Host); |
| 575 | + $index = 0; |
| 576 | + $connection = ($this->smtp->Connected()); |
| 577 | + |
| 578 | + /* Retry while there is no connection */ |
| 579 | + while($index < count($hosts) && $connection == false) { |
| 580 | + $hostinfo = array(); |
| 581 | + if(eregi('^(.+):([0-9]+)$', $hosts[$index], $hostinfo)) { |
| 582 | + $host = $hostinfo[1]; |
| 583 | + $port = $hostinfo[2]; |
| 584 | + } else { |
| 585 | + $host = $hosts[$index]; |
| 586 | + $port = $this->Port; |
| 587 | + } |
| 588 | + |
| 589 | + if($this->smtp->Connect(((!empty($this->SMTPSecure))?$this->SMTPSecure.'://':'').$host, $port, $this->Timeout)) { |
| 590 | + if ($this->Helo != '') { |
| 591 | + $this->smtp->Hello($this->Helo); |
| 592 | + } else { |
| 593 | + $this->smtp->Hello($this->ServerHostname()); |
| 594 | + } |
| 595 | + |
| 596 | + $connection = true; |
| 597 | + if($this->SMTPAuth) { |
| 598 | + if(!$this->smtp->Authenticate($this->Username, $this->Password)) { |
| 599 | + $this->SetError($this->Lang('authenticate')); |
| 600 | + $this->smtp->Reset(); |
| 601 | + $connection = false; |
| 602 | + } |
| 603 | + } |
| 604 | + } |
| 605 | + $index++; |
| 606 | + } |
| 607 | + if(!$connection) { |
| 608 | + $this->SetError($this->Lang('connect_host')); |
| 609 | + } |
| 610 | + |
| 611 | + return $connection; |
| 612 | + } |
| 613 | + |
| 614 | + /** |
| 615 | + * Closes the active SMTP session if one exists. |
| 616 | + * @return void |
| 617 | + */ |
| 618 | + function SmtpClose() { |
| 619 | + if($this->smtp != NULL) { |
| 620 | + if($this->smtp->Connected()) { |
| 621 | + $this->smtp->Quit(); |
| 622 | + $this->smtp->Close(); |
| 623 | + } |
| 624 | + } |
| 625 | + } |
| 626 | + |
| 627 | + /** |
| 628 | + * Sets the language for all class error messages. Returns false |
| 629 | + * if it cannot load the language file. The default language type |
| 630 | + * is English. |
| 631 | + * @param string $lang_type Type of language (e.g. Portuguese: "br") |
| 632 | + * @param string $lang_path Path to the language file directory |
| 633 | + * @access public |
| 634 | + * @return bool |
| 635 | + */ |
| 636 | + function SetLanguage($lang_type, $lang_path = 'language/') { |
| 637 | + if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php')) { |
| 638 | + include($lang_path.'phpmailer.lang-'.$lang_type.'.php'); |
| 639 | + } elseif (file_exists($lang_path.'phpmailer.lang-en.php')) { |
| 640 | + include($lang_path.'phpmailer.lang-en.php'); |
| 641 | + } else { |
| 642 | + $this->SetError('Could not load language file'); |
| 643 | + return false; |
| 644 | + } |
| 645 | + $this->language = $PHPMAILER_LANG; |
| 646 | + |
| 647 | + return true; |
| 648 | + } |
| 649 | + |
| 650 | + ///////////////////////////////////////////////// |
| 651 | + // METHODS, MESSAGE CREATION |
| 652 | + ///////////////////////////////////////////////// |
| 653 | + |
| 654 | + /** |
| 655 | + * Creates recipient headers. |
| 656 | + * @access private |
| 657 | + * @return string |
| 658 | + */ |
| 659 | + function AddrAppend($type, $addr) { |
| 660 | + $addr_str = $type . ': '; |
| 661 | + $addr_str .= $this->AddrFormat($addr[0]); |
| 662 | + if(count($addr) > 1) { |
| 663 | + for($i = 1; $i < count($addr); $i++) { |
| 664 | + $addr_str .= ', ' . $this->AddrFormat($addr[$i]); |
| 665 | + } |
| 666 | + } |
| 667 | + $addr_str .= $this->LE; |
| 668 | + |
| 669 | + return $addr_str; |
| 670 | + } |
| 671 | + |
| 672 | + /** |
| 673 | + * Formats an address correctly. |
| 674 | + * @access private |
| 675 | + * @return string |
| 676 | + */ |
| 677 | + function AddrFormat($addr) { |
| 678 | + if(empty($addr[1])) { |
| 679 | + $formatted = $this->SecureHeader($addr[0]); |
| 680 | + } else { |
| 681 | + $formatted = $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">"; |
| 682 | + } |
| 683 | + |
| 684 | + return $formatted; |
| 685 | + } |
| 686 | + |
| 687 | + /** |
| 688 | + * Wraps message for use with mailers that do not |
| 689 | + * automatically perform wrapping and for quoted-printable. |
| 690 | + * Original written by philippe. |
| 691 | + * @access private |
| 692 | + * @return string |
| 693 | + */ |
| 694 | + function WrapText($message, $length, $qp_mode = false) { |
| 695 | + $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE; |
| 696 | + |
| 697 | + $message = $this->FixEOL($message); |
| 698 | + if (substr($message, -1) == $this->LE) { |
| 699 | + $message = substr($message, 0, -1); |
| 700 | + } |
| 701 | + |
| 702 | + $line = explode($this->LE, $message); |
| 703 | + $message = ''; |
| 704 | + for ($i=0 ;$i < count($line); $i++) { |
| 705 | + $line_part = explode(' ', $line[$i]); |
| 706 | + $buf = ''; |
| 707 | + for ($e = 0; $e<count($line_part); $e++) { |
| 708 | + $word = $line_part[$e]; |
| 709 | + if ($qp_mode and (strlen($word) > $length)) { |
| 710 | + $space_left = $length - strlen($buf) - 1; |
| 711 | + if ($e != 0) { |
| 712 | + if ($space_left > 20) { |
| 713 | + $len = $space_left; |
| 714 | + if (substr($word, $len - 1, 1) == '=') { |
| 715 | + $len--; |
| 716 | + } elseif (substr($word, $len - 2, 1) == '=') { |
| 717 | + $len -= 2; |
| 718 | + } |
| 719 | + $part = substr($word, 0, $len); |
| 720 | + $word = substr($word, $len); |
| 721 | + $buf .= ' ' . $part; |
| 722 | + $message .= $buf . sprintf("=%s", $this->LE); |
| 723 | + } else { |
| 724 | + $message .= $buf . $soft_break; |
| 725 | + } |
| 726 | + $buf = ''; |
| 727 | + } |
| 728 | + while (strlen($word) > 0) { |
| 729 | + $len = $length; |
| 730 | + if (substr($word, $len - 1, 1) == '=') { |
| 731 | + $len--; |
| 732 | + } elseif (substr($word, $len - 2, 1) == '=') { |
| 733 | + $len -= 2; |
| 734 | + } |
| 735 | + $part = substr($word, 0, $len); |
| 736 | + $word = substr($word, $len); |
| 737 | + |
| 738 | + if (strlen($word) > 0) { |
| 739 | + $message .= $part . sprintf("=%s", $this->LE); |
| 740 | + } else { |
| 741 | + $buf = $part; |
| 742 | + } |
| 743 | + } |
| 744 | + } else { |
| 745 | + $buf_o = $buf; |
| 746 | + $buf .= ($e == 0) ? $word : (' ' . $word); |
| 747 | + |
| 748 | + if (strlen($buf) > $length and $buf_o != '') { |
| 749 | + $message .= $buf_o . $soft_break; |
| 750 | + $buf = $word; |
| 751 | + } |
| 752 | + } |
| 753 | + } |
| 754 | + $message .= $buf . $this->LE; |
| 755 | + } |
| 756 | + |
| 757 | + return $message; |
| 758 | + } |
| 759 | + |
| 760 | + /** |
| 761 | + * Set the body wrapping. |
| 762 | + * @access private |
| 763 | + * @return void |
| 764 | + */ |
| 765 | + function SetWordWrap() { |
| 766 | + if($this->WordWrap < 1) { |
| 767 | + return; |
| 768 | + } |
| 769 | + |
| 770 | + switch($this->message_type) { |
| 771 | + case 'alt': |
| 772 | + /* fall through */ |
| 773 | + case 'alt_attachments': |
| 774 | + $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap); |
| 775 | + break; |
| 776 | + default: |
| 777 | + $this->Body = $this->WrapText($this->Body, $this->WordWrap); |
| 778 | + break; |
| 779 | + } |
| 780 | + } |
| 781 | + |
| 782 | + /** |
| 783 | + * Assembles message header. |
| 784 | + * @access private |
| 785 | + * @return string |
| 786 | + */ |
| 787 | + function CreateHeader() { |
| 788 | + $result = ''; |
| 789 | + |
| 790 | + /* Set the boundaries */ |
| 791 | + $uniq_id = md5(uniqid(time())); |
| 792 | + $this->boundary[1] = 'b1_' . $uniq_id; |
| 793 | + $this->boundary[2] = 'b2_' . $uniq_id; |
| 794 | + |
| 795 | + $result .= $this->HeaderLine('Date', $this->RFCDate()); |
| 796 | + if($this->Sender == '') { |
| 797 | + $result .= $this->HeaderLine('Return-Path', trim($this->From)); |
| 798 | + } else { |
| 799 | + $result .= $this->HeaderLine('Return-Path', trim($this->Sender)); |
| 800 | + } |
| 801 | + |
| 802 | + /* To be created automatically by mail() */ |
| 803 | + if($this->Mailer != 'mail') { |
| 804 | + if(count($this->to) > 0) { |
| 805 | + $result .= $this->AddrAppend('To', $this->to); |
| 806 | + } elseif (count($this->cc) == 0) { |
| 807 | + $result .= $this->HeaderLine('To', 'undisclosed-recipients:;'); |
| 808 | + } |
| 809 | + if(count($this->cc) > 0) { |
| 810 | + $result .= $this->AddrAppend('Cc', $this->cc); |
| 811 | + } |
| 812 | + } |
| 813 | + |
| 814 | + $from = array(); |
| 815 | + $from[0][0] = trim($this->From); |
| 816 | + $from[0][1] = $this->FromName; |
| 817 | + $result .= $this->AddrAppend('From', $from); |
| 818 | + |
| 819 | + /* sendmail and mail() extract Cc from the header before sending */ |
| 820 | + if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->cc) > 0)) { |
| 821 | + $result .= $this->AddrAppend('Cc', $this->cc); |
| 822 | + } |
| 823 | + |
| 824 | + /* sendmail and mail() extract Bcc from the header before sending */ |
| 825 | + if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) { |
| 826 | + $result .= $this->AddrAppend('Bcc', $this->bcc); |
| 827 | + } |
| 828 | + |
| 829 | + if(count($this->ReplyTo) > 0) { |
| 830 | + $result .= $this->AddrAppend('Reply-to', $this->ReplyTo); |
| 831 | + } |
| 832 | + |
| 833 | + /* mail() sets the subject itself */ |
| 834 | + if($this->Mailer != 'mail') { |
| 835 | + $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject))); |
| 836 | + } |
| 837 | + |
| 838 | + $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE); |
| 839 | + $result .= $this->HeaderLine('X-Priority', $this->Priority); |
| 840 | + $result .= $this->HeaderLine('X-Mailer', 'PHPMailer (phpmailer.sourceforge.net) [version ' . $this->Version . ']'); |
| 841 | + |
| 842 | + if($this->ConfirmReadingTo != '') { |
| 843 | + $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>'); |
| 844 | + } |
| 845 | + |
| 846 | + // Add custom headers |
| 847 | + for($index = 0; $index < count($this->CustomHeader); $index++) { |
| 848 | + $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1]))); |
| 849 | + } |
| 850 | + $result .= $this->HeaderLine('MIME-Version', '1.0'); |
| 851 | + |
| 852 | + switch($this->message_type) { |
| 853 | + case 'plain': |
| 854 | + $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding); |
| 855 | + $result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet); |
| 856 | + break; |
| 857 | + case 'attachments': |
| 858 | + /* fall through */ |
| 859 | + case 'alt_attachments': |
| 860 | + if($this->InlineImageExists()){ |
| 861 | + $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE); |
| 862 | + } else { |
| 863 | + $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;'); |
| 864 | + $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); |
| 865 | + } |
| 866 | + break; |
| 867 | + case 'alt': |
| 868 | + $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;'); |
| 869 | + $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); |
| 870 | + break; |
| 871 | + } |
| 872 | + |
| 873 | + if($this->Mailer != 'mail') { |
| 874 | + $result .= $this->LE.$this->LE; |
| 875 | + } |
| 876 | + |
| 877 | + return $result; |
| 878 | + } |
| 879 | + |
| 880 | + /** |
| 881 | + * Assembles the message body. Returns an empty string on failure. |
| 882 | + * @access private |
| 883 | + * @return string |
| 884 | + */ |
| 885 | + function CreateBody() { |
| 886 | + $result = ''; |
| 887 | + |
| 888 | + $this->SetWordWrap(); |
| 889 | + |
| 890 | + switch($this->message_type) { |
| 891 | + case 'alt': |
| 892 | + $result .= $this->GetBoundary($this->boundary[1], '', 'text/plain', ''); |
| 893 | + $result .= $this->EncodeString($this->AltBody, $this->Encoding); |
| 894 | + $result .= $this->LE.$this->LE; |
| 895 | + $result .= $this->GetBoundary($this->boundary[1], '', 'text/html', ''); |
| 896 | + $result .= $this->EncodeString($this->Body, $this->Encoding); |
| 897 | + $result .= $this->LE.$this->LE; |
| 898 | + $result .= $this->EndBoundary($this->boundary[1]); |
| 899 | + break; |
| 900 | + case 'plain': |
| 901 | + $result .= $this->EncodeString($this->Body, $this->Encoding); |
| 902 | + break; |
| 903 | + case 'attachments': |
| 904 | + $result .= $this->GetBoundary($this->boundary[1], '', '', ''); |
| 905 | + $result .= $this->EncodeString($this->Body, $this->Encoding); |
| 906 | + $result .= $this->LE; |
| 907 | + $result .= $this->AttachAll(); |
| 908 | + break; |
| 909 | + case 'alt_attachments': |
| 910 | + $result .= sprintf("--%s%s", $this->boundary[1], $this->LE); |
| 911 | + $result .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE); |
| 912 | + $result .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body |
| 913 | + $result .= $this->EncodeString($this->AltBody, $this->Encoding); |
| 914 | + $result .= $this->LE.$this->LE; |
| 915 | + $result .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body |
| 916 | + $result .= $this->EncodeString($this->Body, $this->Encoding); |
| 917 | + $result .= $this->LE.$this->LE; |
| 918 | + $result .= $this->EndBoundary($this->boundary[2]); |
| 919 | + $result .= $this->AttachAll(); |
| 920 | + break; |
| 921 | + } |
| 922 | + if($this->IsError()) { |
| 923 | + $result = ''; |
| 924 | + } |
| 925 | + |
| 926 | + return $result; |
| 927 | + } |
| 928 | + |
| 929 | + /** |
| 930 | + * Returns the start of a message boundary. |
| 931 | + * @access private |
| 932 | + */ |
| 933 | + function GetBoundary($boundary, $charSet, $contentType, $encoding) { |
| 934 | + $result = ''; |
| 935 | + if($charSet == '') { |
| 936 | + $charSet = $this->CharSet; |
| 937 | + } |
| 938 | + if($contentType == '') { |
| 939 | + $contentType = $this->ContentType; |
| 940 | + } |
| 941 | + if($encoding == '') { |
| 942 | + $encoding = $this->Encoding; |
| 943 | + } |
| 944 | + $result .= $this->TextLine('--' . $boundary); |
| 945 | + $result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet); |
| 946 | + $result .= $this->LE; |
| 947 | + $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding); |
| 948 | + $result .= $this->LE; |
| 949 | + |
| 950 | + return $result; |
| 951 | + } |
| 952 | + |
| 953 | + /** |
| 954 | + * Returns the end of a message boundary. |
| 955 | + * @access private |
| 956 | + */ |
| 957 | + function EndBoundary($boundary) { |
| 958 | + return $this->LE . '--' . $boundary . '--' . $this->LE; |
| 959 | + } |
| 960 | + |
| 961 | + /** |
| 962 | + * Sets the message type. |
| 963 | + * @access private |
| 964 | + * @return void |
| 965 | + */ |
| 966 | + function SetMessageType() { |
| 967 | + if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) { |
| 968 | + $this->message_type = 'plain'; |
| 969 | + } else { |
| 970 | + if(count($this->attachment) > 0) { |
| 971 | + $this->message_type = 'attachments'; |
| 972 | + } |
| 973 | + if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) { |
| 974 | + $this->message_type = 'alt'; |
| 975 | + } |
| 976 | + if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) { |
| 977 | + $this->message_type = 'alt_attachments'; |
| 978 | + } |
| 979 | + } |
| 980 | + } |
| 981 | + |
| 982 | + /* Returns a formatted header line. |
| 983 | + * @access private |
| 984 | + * @return string |
| 985 | + */ |
| 986 | + function HeaderLine($name, $value) { |
| 987 | + return $name . ': ' . $value . $this->LE; |
| 988 | + } |
| 989 | + |
| 990 | + /** |
| 991 | + * Returns a formatted mail line. |
| 992 | + * @access private |
| 993 | + * @return string |
| 994 | + */ |
| 995 | + function TextLine($value) { |
| 996 | + return $value . $this->LE; |
| 997 | + } |
| 998 | + |
| 999 | + ///////////////////////////////////////////////// |
| 1000 | + // CLASS METHODS, ATTACHMENTS |
| 1001 | + ///////////////////////////////////////////////// |
| 1002 | + |
| 1003 | + /** |
| 1004 | + * Adds an attachment from a path on the filesystem. |
| 1005 | + * Returns false if the file could not be found |
| 1006 | + * or accessed. |
| 1007 | + * @param string $path Path to the attachment. |
| 1008 | + * @param string $name Overrides the attachment name. |
| 1009 | + * @param string $encoding File encoding (see $Encoding). |
| 1010 | + * @param string $type File extension (MIME) type. |
| 1011 | + * @return bool |
| 1012 | + */ |
| 1013 | + function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') { |
| 1014 | + if(!@is_file($path)) { |
| 1015 | + $this->SetError($this->Lang('file_access') . $path); |
| 1016 | + return false; |
| 1017 | + } |
| 1018 | + |
| 1019 | + $filename = basename($path); |
| 1020 | + if($name == '') { |
| 1021 | + $name = $filename; |
| 1022 | + } |
| 1023 | + |
| 1024 | + $cur = count($this->attachment); |
| 1025 | + $this->attachment[$cur][0] = $path; |
| 1026 | + $this->attachment[$cur][1] = $filename; |
| 1027 | + $this->attachment[$cur][2] = $name; |
| 1028 | + $this->attachment[$cur][3] = $encoding; |
| 1029 | + $this->attachment[$cur][4] = $type; |
| 1030 | + $this->attachment[$cur][5] = false; // isStringAttachment |
| 1031 | + $this->attachment[$cur][6] = 'attachment'; |
| 1032 | + $this->attachment[$cur][7] = 0; |
| 1033 | + |
| 1034 | + return true; |
| 1035 | + } |
| 1036 | + |
| 1037 | + /** |
| 1038 | + * Attaches all fs, string, and binary attachments to the message. |
| 1039 | + * Returns an empty string on failure. |
| 1040 | + * @access private |
| 1041 | + * @return string |
| 1042 | + */ |
| 1043 | + function AttachAll() { |
| 1044 | + /* Return text of body */ |
| 1045 | + $mime = array(); |
| 1046 | + |
| 1047 | + /* Add all attachments */ |
| 1048 | + for($i = 0; $i < count($this->attachment); $i++) { |
| 1049 | + /* Check for string attachment */ |
| 1050 | + $bString = $this->attachment[$i][5]; |
| 1051 | + if ($bString) { |
| 1052 | + $string = $this->attachment[$i][0]; |
| 1053 | + } else { |
| 1054 | + $path = $this->attachment[$i][0]; |
| 1055 | + } |
| 1056 | + |
| 1057 | + $filename = $this->attachment[$i][1]; |
| 1058 | + $name = $this->attachment[$i][2]; |
| 1059 | + $encoding = $this->attachment[$i][3]; |
| 1060 | + $type = $this->attachment[$i][4]; |
| 1061 | + $disposition = $this->attachment[$i][6]; |
| 1062 | + $cid = $this->attachment[$i][7]; |
| 1063 | + |
| 1064 | + $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE); |
| 1065 | + $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE); |
| 1066 | + $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE); |
| 1067 | + |
| 1068 | + if($disposition == 'inline') { |
| 1069 | + $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE); |
| 1070 | + } |
| 1071 | + |
| 1072 | + $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $name, $this->LE.$this->LE); |
| 1073 | + |
| 1074 | + /* Encode as string attachment */ |
| 1075 | + if($bString) { |
| 1076 | + $mime[] = $this->EncodeString($string, $encoding); |
| 1077 | + if($this->IsError()) { |
| 1078 | + return ''; |
| 1079 | + } |
| 1080 | + $mime[] = $this->LE.$this->LE; |
| 1081 | + } else { |
| 1082 | + $mime[] = $this->EncodeFile($path, $encoding); |
| 1083 | + if($this->IsError()) { |
| 1084 | + return ''; |
| 1085 | + } |
| 1086 | + $mime[] = $this->LE.$this->LE; |
| 1087 | + } |
| 1088 | + } |
| 1089 | + |
| 1090 | + $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE); |
| 1091 | + |
| 1092 | + return join('', $mime); |
| 1093 | + } |
| 1094 | + |
| 1095 | + /** |
| 1096 | + * Encodes attachment in requested format. Returns an |
| 1097 | + * empty string on failure. |
| 1098 | + * @access private |
| 1099 | + * @return string |
| 1100 | + */ |
| 1101 | + function EncodeFile ($path, $encoding = 'base64') { |
| 1102 | + if(!@$fd = fopen($path, 'rb')) { |
| 1103 | + $this->SetError($this->Lang('file_open') . $path); |
| 1104 | + return ''; |
| 1105 | + } |
| 1106 | + $magic_quotes = get_magic_quotes_runtime(); |
| 1107 | + set_magic_quotes_runtime(0); |
| 1108 | + $file_buffer = fread($fd, filesize($path)); |
| 1109 | + $file_buffer = $this->EncodeString($file_buffer, $encoding); |
| 1110 | + fclose($fd); |
| 1111 | + set_magic_quotes_runtime($magic_quotes); |
| 1112 | + |
| 1113 | + return $file_buffer; |
| 1114 | + } |
| 1115 | + |
| 1116 | + /** |
| 1117 | + * Encodes string to requested format. Returns an |
| 1118 | + * empty string on failure. |
| 1119 | + * @access private |
| 1120 | + * @return string |
| 1121 | + */ |
| 1122 | + function EncodeString ($str, $encoding = 'base64') { |
| 1123 | + $encoded = ''; |
| 1124 | + switch(strtolower($encoding)) { |
| 1125 | + case 'base64': |
| 1126 | + /* chunk_split is found in PHP >= 3.0.6 */ |
| 1127 | + $encoded = chunk_split(base64_encode($str), 76, $this->LE); |
| 1128 | + break; |
| 1129 | + case '7bit': |
| 1130 | + case '8bit': |
| 1131 | + $encoded = $this->FixEOL($str); |
| 1132 | + if (substr($encoded, -(strlen($this->LE))) != $this->LE) |
| 1133 | + $encoded .= $this->LE; |
| 1134 | + break; |
| 1135 | + case 'binary': |
| 1136 | + $encoded = $str; |
| 1137 | + break; |
| 1138 | + case 'quoted-printable': |
| 1139 | + $encoded = $this->EncodeQP($str); |
| 1140 | + break; |
| 1141 | + default: |
| 1142 | + $this->SetError($this->Lang('encoding') . $encoding); |
| 1143 | + break; |
| 1144 | + } |
| 1145 | + return $encoded; |
| 1146 | + } |
| 1147 | + |
| 1148 | + /** |
| 1149 | + * Encode a header string to best of Q, B, quoted or none. |
| 1150 | + * @access private |
| 1151 | + * @return string |
| 1152 | + */ |
| 1153 | + function EncodeHeader ($str, $position = 'text') { |
| 1154 | + $x = 0; |
| 1155 | + |
| 1156 | + switch (strtolower($position)) { |
| 1157 | + case 'phrase': |
| 1158 | + if (!preg_match('/[\200-\377]/', $str)) { |
| 1159 | + /* Can't use addslashes as we don't know what value has magic_quotes_sybase. */ |
| 1160 | + $encoded = addcslashes($str, "\0..\37\177\\\""); |
| 1161 | + if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) { |
| 1162 | + return ($encoded); |
| 1163 | + } else { |
| 1164 | + return ("\"$encoded\""); |
| 1165 | + } |
| 1166 | + } |
| 1167 | + $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches); |
| 1168 | + break; |
| 1169 | + case 'comment': |
| 1170 | + $x = preg_match_all('/[()"]/', $str, $matches); |
| 1171 | + /* Fall-through */ |
| 1172 | + case 'text': |
| 1173 | + default: |
| 1174 | + $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches); |
| 1175 | + break; |
| 1176 | + } |
| 1177 | + |
| 1178 | + if ($x == 0) { |
| 1179 | + return ($str); |
| 1180 | + } |
| 1181 | + |
| 1182 | + $maxlen = 75 - 7 - strlen($this->CharSet); |
| 1183 | + /* Try to select the encoding which should produce the shortest output */ |
| 1184 | + if (strlen($str)/3 < $x) { |
| 1185 | + $encoding = 'B'; |
| 1186 | + $encoded = base64_encode($str); |
| 1187 | + $maxlen -= $maxlen % 4; |
| 1188 | + $encoded = trim(chunk_split($encoded, $maxlen, "\n")); |
| 1189 | + } else { |
| 1190 | + $encoding = 'Q'; |
| 1191 | + $encoded = $this->EncodeQ($str, $position); |
| 1192 | + $encoded = $this->WrapText($encoded, $maxlen, true); |
| 1193 | + $encoded = str_replace('='.$this->LE, "\n", trim($encoded)); |
| 1194 | + } |
| 1195 | + |
| 1196 | + $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded); |
| 1197 | + $encoded = trim(str_replace("\n", $this->LE, $encoded)); |
| 1198 | + |
| 1199 | + return $encoded; |
| 1200 | + } |
| 1201 | + |
| 1202 | + /** |
| 1203 | + * Encode string to quoted-printable. |
| 1204 | + * @access public |
| 1205 | + * @param string $string the text to encode |
| 1206 | + * @param integer $line_max Number of chars allowed on a line before wrapping |
| 1207 | + * @return string |
| 1208 | + */ |
| 1209 | + public function EncodeQP($string, $line_max = 74) { |
| 1210 | + $fp = fopen('php://temp/', 'r+'); |
| 1211 | + $string = preg_replace('/\r\n?/', $this->LE, $string); //Normalise line breaks |
| 1212 | + $params = array('line-length' => $line_max, 'line-break-chars' => $this->LE); |
| 1213 | + stream_filter_append($fp, 'convert.quoted-printable-encode', STREAM_FILTER_READ, $params); |
| 1214 | + fputs($fp, $string); |
| 1215 | + rewind($fp); |
| 1216 | + $out = stream_get_contents($fp); |
| 1217 | + $out = preg_replace('/^\./m', '=2E', $out); //Encode . if it is first char on a line |
| 1218 | + fclose($fp); |
| 1219 | + return $out; |
| 1220 | + } |
| 1221 | + |
| 1222 | + /** |
| 1223 | + * Encode string to q encoding. |
| 1224 | + * @access private |
| 1225 | + * @return string |
| 1226 | + */ |
| 1227 | + function EncodeQ ($str, $position = 'text') { |
| 1228 | + /* There should not be any EOL in the string */ |
| 1229 | + $encoded = preg_replace("[\r\n]", '', $str); |
| 1230 | + |
| 1231 | + switch (strtolower($position)) { |
| 1232 | + case 'phrase': |
| 1233 | + $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); |
| 1234 | + break; |
| 1235 | + case 'comment': |
| 1236 | + $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); |
| 1237 | + case 'text': |
| 1238 | + default: |
| 1239 | + /* Replace every high ascii, control =, ? and _ characters */ |
| 1240 | + $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e', |
| 1241 | + "'='.sprintf('%02X', ord('\\1'))", $encoded); |
| 1242 | + break; |
| 1243 | + } |
| 1244 | + |
| 1245 | + /* Replace every spaces to _ (more readable than =20) */ |
| 1246 | + $encoded = str_replace(' ', '_', $encoded); |
| 1247 | + |
| 1248 | + return $encoded; |
| 1249 | + } |
| 1250 | + |
| 1251 | + /** |
| 1252 | + * Adds a string or binary attachment (non-filesystem) to the list. |
| 1253 | + * This method can be used to attach ascii or binary data, |
| 1254 | + * such as a BLOB record from a database. |
| 1255 | + * @param string $string String attachment data. |
| 1256 | + * @param string $filename Name of the attachment. |
| 1257 | + * @param string $encoding File encoding (see $Encoding). |
| 1258 | + * @param string $type File extension (MIME) type. |
| 1259 | + * @return void |
| 1260 | + */ |
| 1261 | + function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') { |
| 1262 | + /* Append to $attachment array */ |
| 1263 | + $cur = count($this->attachment); |
| 1264 | + $this->attachment[$cur][0] = $string; |
| 1265 | + $this->attachment[$cur][1] = $filename; |
| 1266 | + $this->attachment[$cur][2] = $filename; |
| 1267 | + $this->attachment[$cur][3] = $encoding; |
| 1268 | + $this->attachment[$cur][4] = $type; |
| 1269 | + $this->attachment[$cur][5] = true; // isString |
| 1270 | + $this->attachment[$cur][6] = 'attachment'; |
| 1271 | + $this->attachment[$cur][7] = 0; |
| 1272 | + } |
| 1273 | + |
| 1274 | + /** |
| 1275 | + * Adds an embedded attachment. This can include images, sounds, and |
| 1276 | + * just about any other document. Make sure to set the $type to an |
| 1277 | + * image type. For JPEG images use "image/jpeg" and for GIF images |
| 1278 | + * use "image/gif". |
| 1279 | + * @param string $path Path to the attachment. |
| 1280 | + * @param string $cid Content ID of the attachment. Use this to identify |
| 1281 | + * the Id for accessing the image in an HTML form. |
| 1282 | + * @param string $name Overrides the attachment name. |
| 1283 | + * @param string $encoding File encoding (see $Encoding). |
| 1284 | + * @param string $type File extension (MIME) type. |
| 1285 | + * @return bool |
| 1286 | + */ |
| 1287 | + function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') { |
| 1288 | + |
| 1289 | + if(!@is_file($path)) { |
| 1290 | + $this->SetError($this->Lang('file_access') . $path); |
| 1291 | + return false; |
| 1292 | + } |
| 1293 | + |
| 1294 | + $filename = basename($path); |
| 1295 | + if($name == '') { |
| 1296 | + $name = $filename; |
| 1297 | + } |
| 1298 | + |
| 1299 | + /* Append to $attachment array */ |
| 1300 | + $cur = count($this->attachment); |
| 1301 | + $this->attachment[$cur][0] = $path; |
| 1302 | + $this->attachment[$cur][1] = $filename; |
| 1303 | + $this->attachment[$cur][2] = $name; |
| 1304 | + $this->attachment[$cur][3] = $encoding; |
| 1305 | + $this->attachment[$cur][4] = $type; |
| 1306 | + $this->attachment[$cur][5] = false; |
| 1307 | + $this->attachment[$cur][6] = 'inline'; |
| 1308 | + $this->attachment[$cur][7] = $cid; |
| 1309 | + |
| 1310 | + return true; |
| 1311 | + } |
| 1312 | + |
| 1313 | + /** |
| 1314 | + * Returns true if an inline attachment is present. |
| 1315 | + * @access private |
| 1316 | + * @return bool |
| 1317 | + */ |
| 1318 | + function InlineImageExists() { |
| 1319 | + $result = false; |
| 1320 | + for($i = 0; $i < count($this->attachment); $i++) { |
| 1321 | + if($this->attachment[$i][6] == 'inline') { |
| 1322 | + $result = true; |
| 1323 | + break; |
| 1324 | + } |
| 1325 | + } |
| 1326 | + |
| 1327 | + return $result; |
| 1328 | + } |
| 1329 | + |
| 1330 | + ///////////////////////////////////////////////// |
| 1331 | + // CLASS METHODS, MESSAGE RESET |
| 1332 | + ///////////////////////////////////////////////// |
| 1333 | + |
| 1334 | + /** |
| 1335 | + * Clears all recipients assigned in the TO array. Returns void. |
| 1336 | + * @return void |
| 1337 | + */ |
| 1338 | + function ClearAddresses() { |
| 1339 | + $this->to = array(); |
| 1340 | + } |
| 1341 | + |
| 1342 | + /** |
| 1343 | + * Clears all recipients assigned in the CC array. Returns void. |
| 1344 | + * @return void |
| 1345 | + */ |
| 1346 | + function ClearCCs() { |
| 1347 | + $this->cc = array(); |
| 1348 | + } |
| 1349 | + |
| 1350 | + /** |
| 1351 | + * Clears all recipients assigned in the BCC array. Returns void. |
| 1352 | + * @return void |
| 1353 | + */ |
| 1354 | + function ClearBCCs() { |
| 1355 | + $this->bcc = array(); |
| 1356 | + } |
| 1357 | + |
| 1358 | + /** |
| 1359 | + * Clears all recipients assigned in the ReplyTo array. Returns void. |
| 1360 | + * @return void |
| 1361 | + */ |
| 1362 | + function ClearReplyTos() { |
| 1363 | + $this->ReplyTo = array(); |
| 1364 | + } |
| 1365 | + |
| 1366 | + /** |
| 1367 | + * Clears all recipients assigned in the TO, CC and BCC |
| 1368 | + * array. Returns void. |
| 1369 | + * @return void |
| 1370 | + */ |
| 1371 | + function ClearAllRecipients() { |
| 1372 | + $this->to = array(); |
| 1373 | + $this->cc = array(); |
| 1374 | + $this->bcc = array(); |
| 1375 | + } |
| 1376 | + |
| 1377 | + /** |
| 1378 | + * Clears all previously set filesystem, string, and binary |
| 1379 | + * attachments. Returns void. |
| 1380 | + * @return void |
| 1381 | + */ |
| 1382 | + function ClearAttachments() { |
| 1383 | + $this->attachment = array(); |
| 1384 | + } |
| 1385 | + |
| 1386 | + /** |
| 1387 | + * Clears all custom headers. Returns void. |
| 1388 | + * @return void |
| 1389 | + */ |
| 1390 | + function ClearCustomHeaders() { |
| 1391 | + $this->CustomHeader = array(); |
| 1392 | + } |
| 1393 | + |
| 1394 | + ///////////////////////////////////////////////// |
| 1395 | + // CLASS METHODS, MISCELLANEOUS |
| 1396 | + ///////////////////////////////////////////////// |
| 1397 | + |
| 1398 | + /** |
| 1399 | + * Adds the error message to the error container. |
| 1400 | + * Returns void. |
| 1401 | + * @access private |
| 1402 | + * @return void |
| 1403 | + */ |
| 1404 | + private function SetError($msg) { |
| 1405 | + $this->error_count++; |
| 1406 | + $this->ErrorInfo = $msg; |
| 1407 | + } |
| 1408 | + |
| 1409 | + /** |
| 1410 | + * Returns the proper RFC 822 formatted date. |
| 1411 | + * @access private |
| 1412 | + * @return string |
| 1413 | + */ |
| 1414 | + private static function RFCDate() { |
| 1415 | + $tz = date('Z'); |
| 1416 | + $tzs = ($tz < 0) ? '-' : '+'; |
| 1417 | + $tz = abs($tz); |
| 1418 | + $tz = (int)($tz/3600)*100 + ($tz%3600)/60; |
| 1419 | + $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz); |
| 1420 | + |
| 1421 | + return $result; |
| 1422 | + } |
| 1423 | + |
| 1424 | + /** |
| 1425 | + * Returns the server hostname or 'localhost.localdomain' if unknown. |
| 1426 | + * @access private |
| 1427 | + * @return string |
| 1428 | + */ |
| 1429 | + private function ServerHostname() { |
| 1430 | + if (!empty($this->Hostname)) { |
| 1431 | + $result = $this->Hostname; |
| 1432 | + } elseif (isset($_SERVER['SERVER_NAME'])) { |
| 1433 | + $result = $_SERVER['SERVER_NAME']; |
| 1434 | + } else { |
| 1435 | + $result = "localhost.localdomain"; |
| 1436 | + } |
| 1437 | + |
| 1438 | + return $result; |
| 1439 | + } |
| 1440 | + |
| 1441 | + /** |
| 1442 | + * Returns a message in the appropriate language. |
| 1443 | + * @access private |
| 1444 | + * @return string |
| 1445 | + */ |
| 1446 | + private function Lang($key) { |
| 1447 | + if(count($this->language) < 1) { |
| 1448 | + $this->SetLanguage('en'); // set the default language |
| 1449 | + } |
| 1450 | + |
| 1451 | + if(isset($this->language[$key])) { |
| 1452 | + return $this->language[$key]; |
| 1453 | + } else { |
| 1454 | + return 'Language string failed to load: ' . $key; |
| 1455 | + } |
| 1456 | + } |
| 1457 | + |
| 1458 | + /** |
| 1459 | + * Returns true if an error occurred. |
| 1460 | + * @return bool |
| 1461 | + */ |
| 1462 | + function IsError() { |
| 1463 | + return ($this->error_count > 0); |
| 1464 | + } |
| 1465 | + |
| 1466 | + /** |
| 1467 | + * Changes every end of line from CR or LF to CRLF. |
| 1468 | + * @access private |
| 1469 | + * @return string |
| 1470 | + */ |
| 1471 | + private function FixEOL($str) { |
| 1472 | + $str = str_replace("\r\n", "\n", $str); |
| 1473 | + $str = str_replace("\r", "\n", $str); |
| 1474 | + $str = str_replace("\n", $this->LE, $str); |
| 1475 | + return $str; |
| 1476 | + } |
| 1477 | + |
| 1478 | + /** |
| 1479 | + * Adds a custom header. |
| 1480 | + * @return void |
| 1481 | + */ |
| 1482 | + function AddCustomHeader($custom_header) { |
| 1483 | + $this->CustomHeader[] = explode(':', $custom_header, 2); |
| 1484 | + } |
| 1485 | + |
| 1486 | + /** |
| 1487 | + * Evaluates the message and returns modifications for inline images and backgrounds |
| 1488 | + * @access public |
| 1489 | + * @return $message |
| 1490 | + */ |
| 1491 | + function MsgHTML($message) { |
| 1492 | + preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images); |
| 1493 | + if(isset($images[2])) { |
| 1494 | + foreach($images[2] as $i => $url) { |
| 1495 | + $filename = basename($url); |
| 1496 | + $directory = dirname($url); |
| 1497 | + $cid = 'cid:' . md5($filename); |
| 1498 | + $fileParts = split("\.", $filename); |
| 1499 | + $ext = $fileParts[1]; |
| 1500 | + $mimeType = $this->_mime_types($ext); |
| 1501 | + $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message); |
| 1502 | + $this->AddEmbeddedImage($url, md5($filename), $filename, 'base64', $mimeType); |
| 1503 | + } |
| 1504 | + } |
| 1505 | + $this->IsHTML(true); |
| 1506 | + $this->Body = $message; |
| 1507 | + $textMsg = trim(strip_tags($message)); |
| 1508 | + if ( !empty($textMsg) && empty($this->AltBody) ) { |
| 1509 | + $this->AltBody = $textMsg; |
| 1510 | + } |
| 1511 | + if ( empty($this->AltBody) ) { |
| 1512 | + $this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n"; |
| 1513 | + } |
| 1514 | + } |
| 1515 | + |
| 1516 | + /** |
| 1517 | + * Gets the mime type of the embedded or inline image |
| 1518 | + * @access private |
| 1519 | + * @return mime type of ext |
| 1520 | + */ |
| 1521 | + function _mime_types($ext = '') { |
| 1522 | + $mimes = array( |
| 1523 | + 'hqx' => 'application/mac-binhex40', |
| 1524 | + 'cpt' => 'application/mac-compactpro', |
| 1525 | + 'doc' => 'application/msword', |
| 1526 | + 'bin' => 'application/macbinary', |
| 1527 | + 'dms' => 'application/octet-stream', |
| 1528 | + 'lha' => 'application/octet-stream', |
| 1529 | + 'lzh' => 'application/octet-stream', |
| 1530 | + 'exe' => 'application/octet-stream', |
| 1531 | + 'class' => 'application/octet-stream', |
| 1532 | + 'psd' => 'application/octet-stream', |
| 1533 | + 'so' => 'application/octet-stream', |
| 1534 | + 'sea' => 'application/octet-stream', |
| 1535 | + 'dll' => 'application/octet-stream', |
| 1536 | + 'oda' => 'application/oda', |
| 1537 | + 'pdf' => 'application/pdf', |
| 1538 | + 'ai' => 'application/postscript', |
| 1539 | + 'eps' => 'application/postscript', |
| 1540 | + 'ps' => 'application/postscript', |
| 1541 | + 'smi' => 'application/smil', |
| 1542 | + 'smil' => 'application/smil', |
| 1543 | + 'mif' => 'application/vnd.mif', |
| 1544 | + 'xls' => 'application/vnd.ms-excel', |
| 1545 | + 'ppt' => 'application/vnd.ms-powerpoint', |
| 1546 | + 'wbxml' => 'application/vnd.wap.wbxml', |
| 1547 | + 'wmlc' => 'application/vnd.wap.wmlc', |
| 1548 | + 'dcr' => 'application/x-director', |
| 1549 | + 'dir' => 'application/x-director', |
| 1550 | + 'dxr' => 'application/x-director', |
| 1551 | + 'dvi' => 'application/x-dvi', |
| 1552 | + 'gtar' => 'application/x-gtar', |
| 1553 | + 'php' => 'application/x-httpd-php', |
| 1554 | + 'php4' => 'application/x-httpd-php', |
| 1555 | + 'php3' => 'application/x-httpd-php', |
| 1556 | + 'phtml' => 'application/x-httpd-php', |
| 1557 | + 'phps' => 'application/x-httpd-php-source', |
| 1558 | + 'js' => 'application/x-javascript', |
| 1559 | + 'swf' => 'application/x-shockwave-flash', |
| 1560 | + 'sit' => 'application/x-stuffit', |
| 1561 | + 'tar' => 'application/x-tar', |
| 1562 | + 'tgz' => 'application/x-tar', |
| 1563 | + 'xhtml' => 'application/xhtml+xml', |
| 1564 | + 'xht' => 'application/xhtml+xml', |
| 1565 | + 'zip' => 'application/zip', |
| 1566 | + 'mid' => 'audio/midi', |
| 1567 | + 'midi' => 'audio/midi', |
| 1568 | + 'mpga' => 'audio/mpeg', |
| 1569 | + 'mp2' => 'audio/mpeg', |
| 1570 | + 'mp3' => 'audio/mpeg', |
| 1571 | + 'aif' => 'audio/x-aiff', |
| 1572 | + 'aiff' => 'audio/x-aiff', |
| 1573 | + 'aifc' => 'audio/x-aiff', |
| 1574 | + 'ram' => 'audio/x-pn-realaudio', |
| 1575 | + 'rm' => 'audio/x-pn-realaudio', |
| 1576 | + 'rpm' => 'audio/x-pn-realaudio-plugin', |
| 1577 | + 'ra' => 'audio/x-realaudio', |
| 1578 | + 'rv' => 'video/vnd.rn-realvideo', |
| 1579 | + 'wav' => 'audio/x-wav', |
| 1580 | + 'bmp' => 'image/bmp', |
| 1581 | + 'gif' => 'image/gif', |
| 1582 | + 'jpeg' => 'image/jpeg', |
| 1583 | + 'jpg' => 'image/jpeg', |
| 1584 | + 'jpe' => 'image/jpeg', |
| 1585 | + 'png' => 'image/png', |
| 1586 | + 'tiff' => 'image/tiff', |
| 1587 | + 'tif' => 'image/tiff', |
| 1588 | + 'css' => 'text/css', |
| 1589 | + 'html' => 'text/html', |
| 1590 | + 'htm' => 'text/html', |
| 1591 | + 'shtml' => 'text/html', |
| 1592 | + 'txt' => 'text/plain', |
| 1593 | + 'text' => 'text/plain', |
| 1594 | + 'log' => 'text/plain', |
| 1595 | + 'rtx' => 'text/richtext', |
| 1596 | + 'rtf' => 'text/rtf', |
| 1597 | + 'xml' => 'text/xml', |
| 1598 | + 'xsl' => 'text/xml', |
| 1599 | + 'mpeg' => 'video/mpeg', |
| 1600 | + 'mpg' => 'video/mpeg', |
| 1601 | + 'mpe' => 'video/mpeg', |
| 1602 | + 'qt' => 'video/quicktime', |
| 1603 | + 'mov' => 'video/quicktime', |
| 1604 | + 'avi' => 'video/x-msvideo', |
| 1605 | + 'movie' => 'video/x-sgi-movie', |
| 1606 | + 'doc' => 'application/msword', |
| 1607 | + 'word' => 'application/msword', |
| 1608 | + 'xl' => 'application/excel', |
| 1609 | + 'eml' => 'message/rfc822' |
| 1610 | + ); |
| 1611 | + return ( ! isset($mimes[strtolower($ext)])) ? 'application/x-unknown-content-type' : $mimes[strtolower($ext)]; |
| 1612 | + } |
| 1613 | + |
| 1614 | + /** |
| 1615 | + * Set (or reset) Class Objects (variables) |
| 1616 | + * |
| 1617 | + * Usage Example: |
| 1618 | + * $page->set('X-Priority', '3'); |
| 1619 | + * |
| 1620 | + * @access public |
| 1621 | + * @param string $name Parameter Name |
| 1622 | + * @param mixed $value Parameter Value |
| 1623 | + * NOTE: will not work with arrays, there are no arrays to set/reset |
| 1624 | + */ |
| 1625 | + function set ( $name, $value = '' ) { |
| 1626 | + if ( isset($this->$name) ) { |
| 1627 | + $this->$name = $value; |
| 1628 | + } else { |
| 1629 | + $this->SetError('Cannot set or reset variable ' . $name); |
| 1630 | + return false; |
| 1631 | + } |
| 1632 | + } |
| 1633 | + |
| 1634 | + /** |
| 1635 | + * Read a file from a supplied filename and return it. |
| 1636 | + * |
| 1637 | + * @access public |
| 1638 | + * @param string $filename Parameter File Name |
| 1639 | + */ |
| 1640 | + function getFile($filename) { |
| 1641 | + $return = ''; |
| 1642 | + if ($fp = fopen($filename, 'rb')) { |
| 1643 | + while (!feof($fp)) { |
| 1644 | + $return .= fread($fp, 1024); |
| 1645 | + } |
| 1646 | + fclose($fp); |
| 1647 | + return $return; |
| 1648 | + } else { |
| 1649 | + return false; |
| 1650 | + } |
| 1651 | + } |
| 1652 | + |
| 1653 | + /** |
| 1654 | + * Strips newlines to prevent header injection. |
| 1655 | + * @access private |
| 1656 | + * @param string $str String |
| 1657 | + * @return string |
| 1658 | + */ |
| 1659 | + function SecureHeader($str) { |
| 1660 | + $str = trim($str); |
| 1661 | + $str = str_replace("\r", "", $str); |
| 1662 | + $str = str_replace("\n", "", $str); |
| 1663 | + return $str; |
| 1664 | + } |
| 1665 | + |
| 1666 | +} |
| 1667 | + |
| 1668 | +?> |
Property changes on: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/class.phpmailer.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 1669 | + native |
Index: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/class.pop3.php |
— | — | @@ -0,0 +1,391 @@ |
| 2 | +<?php |
| 3 | +/*~ class.pop3.php |
| 4 | +.---------------------------------------------------------------------------. |
| 5 | +| Software: PHPMailer - PHP email class | |
| 6 | +| Version: 2.0.0 rc2 | |
| 7 | +| Contact: via sourceforge.net support pages (also www.codeworxtech.com) | |
| 8 | +| Info: http://phpmailer.sourceforge.net | |
| 9 | +| Support: http://sourceforge.net/projects/phpmailer/ | |
| 10 | +| ------------------------------------------------------------------------- | |
| 11 | +| Author: Andy Prevost (project admininistrator) | |
| 12 | +| Author: Brent R. Matzelle (original founder) | |
| 13 | +| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. | |
| 14 | +| Copyright (c) 2001-2003, Brent R. Matzelle | |
| 15 | +| ------------------------------------------------------------------------- | |
| 16 | +| License: Distributed under the Lesser General Public License (LGPL) | |
| 17 | +| http://www.gnu.org/copyleft/lesser.html | |
| 18 | +| This program is distributed in the hope that it will be useful - WITHOUT | |
| 19 | +| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 20 | +| FITNESS FOR A PARTICULAR PURPOSE. | |
| 21 | +| ------------------------------------------------------------------------- | |
| 22 | +| We offer a number of paid services (www.codeworxtech.com): | |
| 23 | +| - Web Hosting on highly optimized fast and secure servers | |
| 24 | +| - Technology Consulting | |
| 25 | +| - Oursourcing (highly qualified programmers and graphic designers) | |
| 26 | +'---------------------------------------------------------------------------' |
| 27 | + |
| 28 | +/** |
| 29 | + * POP Before SMTP Authentication Class |
| 30 | + * Version 1.0 |
| 31 | + * |
| 32 | + * Author: Richard Davey (rich@corephp.co.uk) |
| 33 | + * License: LGPL, see PHPMailer License |
| 34 | + * |
| 35 | + * Specifically for PHPMailer to allow POP before SMTP authentication. |
| 36 | + * Does not yet work with APOP - if you have an APOP account, contact me |
| 37 | + * and we can test changes to this script. |
| 38 | + * |
| 39 | + * This class is based on the structure of the SMTP class by Chris Ryan |
| 40 | + * |
| 41 | + * This class is rfc 1939 compliant and implements all the commands |
| 42 | + * required for POP3 connection, authentication and disconnection. |
| 43 | + * |
| 44 | + * @package PHPMailer |
| 45 | + * @author Richard Davey |
| 46 | + */ |
| 47 | + |
| 48 | +class POP3 { |
| 49 | + /** |
| 50 | + * Default POP3 port |
| 51 | + * @var int |
| 52 | + */ |
| 53 | + public $POP3_PORT = 110; |
| 54 | + |
| 55 | + /** |
| 56 | + * Default Timeout |
| 57 | + * @var int |
| 58 | + */ |
| 59 | + public $POP3_TIMEOUT = 30; |
| 60 | + |
| 61 | + /** |
| 62 | + * POP3 Carriage Return + Line Feed |
| 63 | + * @var string |
| 64 | + */ |
| 65 | + public $CRLF = "\r\n"; |
| 66 | + |
| 67 | + /** |
| 68 | + * Displaying Debug warnings? (0 = now, 1+ = yes) |
| 69 | + * @var int |
| 70 | + */ |
| 71 | + public $do_debug = 2; |
| 72 | + |
| 73 | + /** |
| 74 | + * POP3 Mail Server |
| 75 | + * @var string |
| 76 | + */ |
| 77 | + public $host; |
| 78 | + |
| 79 | + /** |
| 80 | + * POP3 Port |
| 81 | + * @var int |
| 82 | + */ |
| 83 | + public $port; |
| 84 | + |
| 85 | + /** |
| 86 | + * POP3 Timeout Value |
| 87 | + * @var int |
| 88 | + */ |
| 89 | + public $tval; |
| 90 | + |
| 91 | + /** |
| 92 | + * POP3 Username |
| 93 | + * @var string |
| 94 | + */ |
| 95 | + public $username; |
| 96 | + |
| 97 | + /** |
| 98 | + * POP3 Password |
| 99 | + * @var string |
| 100 | + */ |
| 101 | + public $password; |
| 102 | + |
| 103 | + /**#@+ |
| 104 | + * @access private |
| 105 | + */ |
| 106 | + private $pop_conn; |
| 107 | + private $connected; |
| 108 | + private $error; // Error log array |
| 109 | + /**#@-*/ |
| 110 | + |
| 111 | + /** |
| 112 | + * Constructor, sets the initial values |
| 113 | + * |
| 114 | + * @return POP3 |
| 115 | + */ |
| 116 | + function __construct() { |
| 117 | + $this->pop_conn = 0; |
| 118 | + $this->connected = false; |
| 119 | + $this->error = null; |
| 120 | + } |
| 121 | + |
| 122 | + /** |
| 123 | + * Combination of public events - connect, login, disconnect |
| 124 | + * |
| 125 | + * @param string $host |
| 126 | + * @param integer $port |
| 127 | + * @param integer $tval |
| 128 | + * @param string $username |
| 129 | + * @param string $password |
| 130 | + */ |
| 131 | + function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0) { |
| 132 | + $this->host = $host; |
| 133 | + |
| 134 | + // If no port value is passed, retrieve it |
| 135 | + if ($port == false) { |
| 136 | + $this->port = $this->POP3_PORT; |
| 137 | + } else { |
| 138 | + $this->port = $port; |
| 139 | + } |
| 140 | + |
| 141 | + // If no port value is passed, retrieve it |
| 142 | + if ($tval == false) { |
| 143 | + $this->tval = $this->POP3_TIMEOUT; |
| 144 | + } else { |
| 145 | + $this->tval = $tval; |
| 146 | + } |
| 147 | + |
| 148 | + $this->do_debug = $debug_level; |
| 149 | + $this->username = $username; |
| 150 | + $this->password = $password; |
| 151 | + |
| 152 | + // Refresh the error log |
| 153 | + $this->error = null; |
| 154 | + |
| 155 | + // Connect |
| 156 | + $result = $this->Connect($this->host, $this->port, $this->tval); |
| 157 | + |
| 158 | + if ($result) { |
| 159 | + $login_result = $this->Login($this->username, $this->password); |
| 160 | + |
| 161 | + if ($login_result) { |
| 162 | + $this->Disconnect(); |
| 163 | + |
| 164 | + return true; |
| 165 | + } |
| 166 | + |
| 167 | + } |
| 168 | + |
| 169 | + // We need to disconnect regardless if the login succeeded |
| 170 | + $this->Disconnect(); |
| 171 | + |
| 172 | + return false; |
| 173 | + } |
| 174 | + |
| 175 | + /** |
| 176 | + * Connect to the POP3 server |
| 177 | + * |
| 178 | + * @param string $host |
| 179 | + * @param integer $port |
| 180 | + * @param integer $tval |
| 181 | + * @return boolean |
| 182 | + */ |
| 183 | + function Connect ($host, $port = false, $tval = 30) { |
| 184 | + // Are we already connected? |
| 185 | + if ($this->connected) { |
| 186 | + return true; |
| 187 | + } |
| 188 | + |
| 189 | + /* |
| 190 | + On Windows this will raise a PHP Warning error if the hostname doesn't exist. |
| 191 | + Rather than supress it with @fsockopen, let's capture it cleanly instead |
| 192 | + */ |
| 193 | + |
| 194 | + set_error_handler(array(&$this, 'catchWarning')); |
| 195 | + |
| 196 | + // Connect to the POP3 server |
| 197 | + $this->pop_conn = fsockopen($host, // POP3 Host |
| 198 | + $port, // Port # |
| 199 | + $errno, // Error Number |
| 200 | + $errstr, // Error Message |
| 201 | + $tval); // Timeout (seconds) |
| 202 | + |
| 203 | + // Restore the error handler |
| 204 | + restore_error_handler(); |
| 205 | + |
| 206 | + // Does the Error Log now contain anything? |
| 207 | + if ($this->error && $this->do_debug >= 1) { |
| 208 | + $this->displayErrors(); |
| 209 | + } |
| 210 | + |
| 211 | + // Did we connect? |
| 212 | + if ($this->pop_conn == false) { |
| 213 | + // It would appear not... |
| 214 | + $this->error = array( |
| 215 | + 'error' => "Failed to connect to server $host on port $port", |
| 216 | + 'errno' => $errno, |
| 217 | + 'errstr' => $errstr |
| 218 | + ); |
| 219 | + |
| 220 | + if ($this->do_debug >= 1) { |
| 221 | + $this->displayErrors(); |
| 222 | + } |
| 223 | + |
| 224 | + return false; |
| 225 | + } |
| 226 | + |
| 227 | + // Increase the stream time-out |
| 228 | + |
| 229 | + // Check for PHP 4.3.0 or later |
| 230 | + if (version_compare(phpversion(), '4.3.0', 'ge')) { |
| 231 | + stream_set_timeout($this->pop_conn, $tval, 0); |
| 232 | + } else { |
| 233 | + // Does not work on Windows |
| 234 | + if (substr(PHP_OS, 0, 3) !== 'WIN') { |
| 235 | + socket_set_timeout($this->pop_conn, $tval, 0); |
| 236 | + } |
| 237 | + } |
| 238 | + |
| 239 | + // Get the POP3 server response |
| 240 | + $pop3_response = $this->getResponse(); |
| 241 | + |
| 242 | + // Check for the +OK |
| 243 | + if ($this->checkResponse($pop3_response)) { |
| 244 | + // The connection is established and the POP3 server is talking |
| 245 | + $this->connected = true; |
| 246 | + return true; |
| 247 | + } |
| 248 | + |
| 249 | + } |
| 250 | + |
| 251 | + /** |
| 252 | + * Login to the POP3 server (does not support APOP yet) |
| 253 | + * |
| 254 | + * @param string $username |
| 255 | + * @param string $password |
| 256 | + * @return boolean |
| 257 | + */ |
| 258 | + function Login ($username = '', $password = '') { |
| 259 | + if ($this->connected == false) { |
| 260 | + $this->error = 'Not connected to POP3 server'; |
| 261 | + |
| 262 | + if ($this->do_debug >= 1) { |
| 263 | + $this->displayErrors(); |
| 264 | + } |
| 265 | + } |
| 266 | + |
| 267 | + if (empty($username)) { |
| 268 | + $username = $this->username; |
| 269 | + } |
| 270 | + |
| 271 | + if (empty($password)) { |
| 272 | + $password = $this->password; |
| 273 | + } |
| 274 | + |
| 275 | + $pop_username = "USER $username" . $this->CRLF; |
| 276 | + $pop_password = "PASS $password" . $this->CRLF; |
| 277 | + |
| 278 | + // Send the Username |
| 279 | + $this->sendString($pop_username); |
| 280 | + $pop3_response = $this->getResponse(); |
| 281 | + |
| 282 | + if ($this->checkResponse($pop3_response)) { |
| 283 | + // Send the Password |
| 284 | + $this->sendString($pop_password); |
| 285 | + $pop3_response = $this->getResponse(); |
| 286 | + |
| 287 | + if ($this->checkResponse($pop3_response)) { |
| 288 | + return true; |
| 289 | + } else { |
| 290 | + return false; |
| 291 | + } |
| 292 | + } else { |
| 293 | + return false; |
| 294 | + } |
| 295 | + } |
| 296 | + |
| 297 | + /** |
| 298 | + * Disconnect from the POP3 server |
| 299 | + */ |
| 300 | + function Disconnect () { |
| 301 | + $this->sendString('QUIT'); |
| 302 | + |
| 303 | + fclose($this->pop_conn); |
| 304 | + } |
| 305 | + |
| 306 | + ///////////////////////////////////////////////// |
| 307 | + // Private Methods |
| 308 | + ///////////////////////////////////////////////// |
| 309 | + |
| 310 | + /** |
| 311 | + * Get the socket response back. |
| 312 | + * $size is the maximum number of bytes to retrieve |
| 313 | + * |
| 314 | + * @param integer $size |
| 315 | + * @return string |
| 316 | + */ |
| 317 | + function getResponse ($size = 128) { |
| 318 | + $pop3_response = fgets($this->pop_conn, $size); |
| 319 | + |
| 320 | + return $pop3_response; |
| 321 | + } |
| 322 | + |
| 323 | + /** |
| 324 | + * Send a string down the open socket connection to the POP3 server |
| 325 | + * |
| 326 | + * @param string $string |
| 327 | + * @return integer |
| 328 | + */ |
| 329 | + function sendString ($string) { |
| 330 | + $bytes_sent = fwrite($this->pop_conn, $string, strlen($string)); |
| 331 | + |
| 332 | + return $bytes_sent; |
| 333 | + } |
| 334 | + |
| 335 | + /** |
| 336 | + * Checks the POP3 server response for +OK or -ERR |
| 337 | + * |
| 338 | + * @param string $string |
| 339 | + * @return boolean |
| 340 | + */ |
| 341 | + function checkResponse ($string) { |
| 342 | + if (substr($string, 0, 3) !== '+OK') { |
| 343 | + $this->error = array( |
| 344 | + 'error' => "Server reported an error: $string", |
| 345 | + 'errno' => 0, |
| 346 | + 'errstr' => '' |
| 347 | + ); |
| 348 | + |
| 349 | + if ($this->do_debug >= 1) { |
| 350 | + $this->displayErrors(); |
| 351 | + } |
| 352 | + |
| 353 | + return false; |
| 354 | + } else { |
| 355 | + return true; |
| 356 | + } |
| 357 | + |
| 358 | + } |
| 359 | + |
| 360 | + /** |
| 361 | + * If debug is enabled, display the error message array |
| 362 | + * |
| 363 | + */ |
| 364 | + function displayErrors () { |
| 365 | + echo '<pre>'; |
| 366 | + |
| 367 | + foreach ($this->error as $single_error) { |
| 368 | + print_r($single_error); |
| 369 | + } |
| 370 | + |
| 371 | + echo '</pre>'; |
| 372 | + } |
| 373 | + |
| 374 | + /** |
| 375 | + * Takes over from PHP for the socket warning handler |
| 376 | + * |
| 377 | + * @param integer $errno |
| 378 | + * @param string $errstr |
| 379 | + * @param string $errfile |
| 380 | + * @param integer $errline |
| 381 | + */ |
| 382 | + function catchWarning ($errno, $errstr, $errfile, $errline) { |
| 383 | + $this->error[] = array( |
| 384 | + 'error' => "Connecting to the POP3 server raised a PHP warning: ", |
| 385 | + 'errno' => $errno, |
| 386 | + 'errstr' => $errstr |
| 387 | + ); |
| 388 | + } |
| 389 | + |
| 390 | + // End of class |
| 391 | +} |
| 392 | +?> |
Property changes on: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/class.pop3.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 393 | + native |
Index: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/class.smtp.php |
— | — | @@ -0,0 +1,1065 @@ |
| 2 | +<?php |
| 3 | +/*~ class.smtp.php |
| 4 | +.---------------------------------------------------------------------------. |
| 5 | +| Software: PHPMailer - PHP email class | |
| 6 | +| Version: 2.0.0 rc1 | |
| 7 | +| Contact: via sourceforge.net support pages (also www.codeworxtech.com) | |
| 8 | +| Info: http://phpmailer.sourceforge.net | |
| 9 | +| Support: http://sourceforge.net/projects/phpmailer/ | |
| 10 | +| ------------------------------------------------------------------------- | |
| 11 | +| Author: Andy Prevost (project admininistrator) | |
| 12 | +| Author: Brent R. Matzelle (original founder) | |
| 13 | +| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. | |
| 14 | +| Copyright (c) 2001-2003, Brent R. Matzelle | |
| 15 | +| ------------------------------------------------------------------------- | |
| 16 | +| License: Distributed under the Lesser General Public License (LGPL) | |
| 17 | +| http://www.gnu.org/copyleft/lesser.html | |
| 18 | +| This program is distributed in the hope that it will be useful - WITHOUT | |
| 19 | +| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 20 | +| FITNESS FOR A PARTICULAR PURPOSE. | |
| 21 | +| ------------------------------------------------------------------------- | |
| 22 | +| We offer a number of paid services (www.codeworxtech.com): | |
| 23 | +| - Web Hosting on highly optimized fast and secure servers | |
| 24 | +| - Technology Consulting | |
| 25 | +| - Oursourcing (highly qualified programmers and graphic designers) | |
| 26 | +'---------------------------------------------------------------------------' |
| 27 | + |
| 28 | +/** |
| 29 | + * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP |
| 30 | + * commands except TURN which will always return a not implemented |
| 31 | + * error. SMTP also provides some utility methods for sending mail |
| 32 | + * to an SMTP server. |
| 33 | + * @package PHPMailer |
| 34 | + * @author Chris Ryan |
| 35 | + */ |
| 36 | + |
| 37 | +class SMTP { |
| 38 | + /** |
| 39 | + * SMTP server port |
| 40 | + * @var int |
| 41 | + */ |
| 42 | + public $SMTP_PORT = 25; |
| 43 | + |
| 44 | + /** |
| 45 | + * SMTP reply line ending |
| 46 | + * @var string |
| 47 | + */ |
| 48 | + public $CRLF = "\r\n"; |
| 49 | + |
| 50 | + /** |
| 51 | + * Sets whether debugging is turned on |
| 52 | + * @var bool |
| 53 | + */ |
| 54 | + public $do_debug; // the level of debug to perform |
| 55 | + |
| 56 | + /** |
| 57 | + * Sets VERP use on/off (default is off) |
| 58 | + * @var bool |
| 59 | + */ |
| 60 | + public $do_verp = false; |
| 61 | + |
| 62 | + /**#@+ |
| 63 | + * @access private |
| 64 | + */ |
| 65 | + private $smtp_conn; // the socket to the server |
| 66 | + private $error; // error if any on the last call |
| 67 | + private $helo_rply; // the reply the server sent to us for HELO |
| 68 | + /**#@-*/ |
| 69 | + |
| 70 | + /** |
| 71 | + * Initialize the class so that the data is in a known state. |
| 72 | + * @access public |
| 73 | + * @return void |
| 74 | + */ |
| 75 | + function __construct() { |
| 76 | + $this->smtp_conn = 0; |
| 77 | + $this->error = null; |
| 78 | + $this->helo_rply = null; |
| 79 | + |
| 80 | + $this->do_debug = 0; |
| 81 | + } |
| 82 | + |
| 83 | + /************************************************************* |
| 84 | + * CONNECTION FUNCTIONS * |
| 85 | + ***********************************************************/ |
| 86 | + |
| 87 | + /** |
| 88 | + * Connect to the server specified on the port specified. |
| 89 | + * If the port is not specified use the default SMTP_PORT. |
| 90 | + * If tval is specified then a connection will try and be |
| 91 | + * established with the server for that number of seconds. |
| 92 | + * If tval is not specified the default is 30 seconds to |
| 93 | + * try on the connection. |
| 94 | + * |
| 95 | + * SMTP CODE SUCCESS: 220 |
| 96 | + * SMTP CODE FAILURE: 421 |
| 97 | + * @access public |
| 98 | + * @return bool |
| 99 | + */ |
| 100 | + function Connect($host,$port=0,$tval=30) { |
| 101 | + /* set the error val to null so there is no confusion */ |
| 102 | + $this->error = null; |
| 103 | + |
| 104 | + /* make sure we are __not__ connected */ |
| 105 | + if($this->connected()) { |
| 106 | + /* ok we are connected! what should we do? |
| 107 | + * for now we will just give an error saying we |
| 108 | + * are already connected |
| 109 | + */ |
| 110 | + $this->error = array("error" => "Already connected to a server"); |
| 111 | + return false; |
| 112 | + } |
| 113 | + |
| 114 | + if(empty($port)) { |
| 115 | + $port = $this->SMTP_PORT; |
| 116 | + } |
| 117 | + |
| 118 | + /* connect to the smtp server */ |
| 119 | + $this->smtp_conn = fsockopen($host, // the host of the server |
| 120 | + $port, // the port to use |
| 121 | + $errno, // error number if any |
| 122 | + $errstr, // error message if any |
| 123 | + $tval); // give up after ? secs |
| 124 | + /* verify we connected properly */ |
| 125 | + if(empty($this->smtp_conn)) { |
| 126 | + $this->error = array("error" => "Failed to connect to server", |
| 127 | + "errno" => $errno, |
| 128 | + "errstr" => $errstr); |
| 129 | + if($this->do_debug >= 1) { |
| 130 | + echo "SMTP -> ERROR: " . $this->error["error"] . |
| 131 | + ": $errstr ($errno)" . $this->CRLF; |
| 132 | + } |
| 133 | + return false; |
| 134 | + } |
| 135 | + |
| 136 | + /* sometimes the SMTP server takes a little longer to respond |
| 137 | + * so we will give it a longer timeout for the first read |
| 138 | + * - Windows still does not have support for this timeout function |
| 139 | + */ |
| 140 | + if(substr(PHP_OS, 0, 3) != "WIN") |
| 141 | + socket_set_timeout($this->smtp_conn, $tval, 0); |
| 142 | + |
| 143 | + /* get any announcement stuff */ |
| 144 | + $announce = $this->get_lines(); |
| 145 | + |
| 146 | + /* set the timeout of any socket functions at 1/10 of a second */ |
| 147 | + //if(function_exists("socket_set_timeout")) |
| 148 | + // socket_set_timeout($this->smtp_conn, 0, 100000); |
| 149 | + |
| 150 | + if($this->do_debug >= 2) { |
| 151 | + echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce; |
| 152 | + } |
| 153 | + |
| 154 | + return true; |
| 155 | + } |
| 156 | + |
| 157 | + /** |
| 158 | + * Performs SMTP authentication. Must be run after running the |
| 159 | + * Hello() method. Returns true if successfully authenticated. |
| 160 | + * @access public |
| 161 | + * @return bool |
| 162 | + */ |
| 163 | + function Authenticate($username, $password) { |
| 164 | + // Start authentication |
| 165 | + fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF); |
| 166 | + |
| 167 | + $rply = $this->get_lines(); |
| 168 | + $code = substr($rply,0,3); |
| 169 | + |
| 170 | + if($code != 334) { |
| 171 | + $this->error = |
| 172 | + array("error" => "AUTH not accepted from server", |
| 173 | + "smtp_code" => $code, |
| 174 | + "smtp_msg" => substr($rply,4)); |
| 175 | + if($this->do_debug >= 1) { |
| 176 | + echo "SMTP -> ERROR: " . $this->error["error"] . |
| 177 | + ": " . $rply . $this->CRLF; |
| 178 | + } |
| 179 | + return false; |
| 180 | + } |
| 181 | + |
| 182 | + // Send encoded username |
| 183 | + fputs($this->smtp_conn, base64_encode($username) . $this->CRLF); |
| 184 | + |
| 185 | + $rply = $this->get_lines(); |
| 186 | + $code = substr($rply,0,3); |
| 187 | + |
| 188 | + if($code != 334) { |
| 189 | + $this->error = |
| 190 | + array("error" => "Username not accepted from server", |
| 191 | + "smtp_code" => $code, |
| 192 | + "smtp_msg" => substr($rply,4)); |
| 193 | + if($this->do_debug >= 1) { |
| 194 | + echo "SMTP -> ERROR: " . $this->error["error"] . |
| 195 | + ": " . $rply . $this->CRLF; |
| 196 | + } |
| 197 | + return false; |
| 198 | + } |
| 199 | + |
| 200 | + // Send encoded password |
| 201 | + fputs($this->smtp_conn, base64_encode($password) . $this->CRLF); |
| 202 | + |
| 203 | + $rply = $this->get_lines(); |
| 204 | + $code = substr($rply,0,3); |
| 205 | + |
| 206 | + if($code != 235) { |
| 207 | + $this->error = |
| 208 | + array("error" => "Password not accepted from server", |
| 209 | + "smtp_code" => $code, |
| 210 | + "smtp_msg" => substr($rply,4)); |
| 211 | + if($this->do_debug >= 1) { |
| 212 | + echo "SMTP -> ERROR: " . $this->error["error"] . |
| 213 | + ": " . $rply . $this->CRLF; |
| 214 | + } |
| 215 | + return false; |
| 216 | + } |
| 217 | + |
| 218 | + return true; |
| 219 | + } |
| 220 | + |
| 221 | + /** |
| 222 | + * Returns true if connected to a server otherwise false |
| 223 | + * @access private |
| 224 | + * @return bool |
| 225 | + */ |
| 226 | + function Connected() { |
| 227 | + if(!empty($this->smtp_conn)) { |
| 228 | + $sock_status = socket_get_status($this->smtp_conn); |
| 229 | + if($sock_status["eof"]) { |
| 230 | + // hmm this is an odd situation... the socket is |
| 231 | + // valid but we are not connected anymore |
| 232 | + if($this->do_debug >= 1) { |
| 233 | + echo "SMTP -> NOTICE:" . $this->CRLF . |
| 234 | + "EOF caught while checking if connected"; |
| 235 | + } |
| 236 | + $this->Close(); |
| 237 | + return false; |
| 238 | + } |
| 239 | + return true; // everything looks good |
| 240 | + } |
| 241 | + return false; |
| 242 | + } |
| 243 | + |
| 244 | + /** |
| 245 | + * Closes the socket and cleans up the state of the class. |
| 246 | + * It is not considered good to use this function without |
| 247 | + * first trying to use QUIT. |
| 248 | + * @access public |
| 249 | + * @return void |
| 250 | + */ |
| 251 | + function Close() { |
| 252 | + $this->error = null; // so there is no confusion |
| 253 | + $this->helo_rply = null; |
| 254 | + if(!empty($this->smtp_conn)) { |
| 255 | + // close the connection and cleanup |
| 256 | + fclose($this->smtp_conn); |
| 257 | + $this->smtp_conn = 0; |
| 258 | + } |
| 259 | + } |
| 260 | + |
| 261 | + /*************************************************************** |
| 262 | + * SMTP COMMANDS * |
| 263 | + *************************************************************/ |
| 264 | + |
| 265 | + /** |
| 266 | + * Issues a data command and sends the msg_data to the server |
| 267 | + * finializing the mail transaction. $msg_data is the message |
| 268 | + * that is to be send with the headers. Each header needs to be |
| 269 | + * on a single line followed by a <CRLF> with the message headers |
| 270 | + * and the message body being seperated by and additional <CRLF>. |
| 271 | + * |
| 272 | + * Implements rfc 821: DATA <CRLF> |
| 273 | + * |
| 274 | + * SMTP CODE INTERMEDIATE: 354 |
| 275 | + * [data] |
| 276 | + * <CRLF>.<CRLF> |
| 277 | + * SMTP CODE SUCCESS: 250 |
| 278 | + * SMTP CODE FAILURE: 552,554,451,452 |
| 279 | + * SMTP CODE FAILURE: 451,554 |
| 280 | + * SMTP CODE ERROR : 500,501,503,421 |
| 281 | + * @access public |
| 282 | + * @return bool |
| 283 | + */ |
| 284 | + function Data($msg_data) { |
| 285 | + $this->error = null; // so no confusion is caused |
| 286 | + |
| 287 | + if(!$this->connected()) { |
| 288 | + $this->error = array( |
| 289 | + "error" => "Called Data() without being connected"); |
| 290 | + return false; |
| 291 | + } |
| 292 | + |
| 293 | + fputs($this->smtp_conn,"DATA" . $this->CRLF); |
| 294 | + |
| 295 | + $rply = $this->get_lines(); |
| 296 | + $code = substr($rply,0,3); |
| 297 | + |
| 298 | + if($this->do_debug >= 2) { |
| 299 | + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
| 300 | + } |
| 301 | + |
| 302 | + if($code != 354) { |
| 303 | + $this->error = |
| 304 | + array("error" => "DATA command not accepted from server", |
| 305 | + "smtp_code" => $code, |
| 306 | + "smtp_msg" => substr($rply,4)); |
| 307 | + if($this->do_debug >= 1) { |
| 308 | + echo "SMTP -> ERROR: " . $this->error["error"] . |
| 309 | + ": " . $rply . $this->CRLF; |
| 310 | + } |
| 311 | + return false; |
| 312 | + } |
| 313 | + |
| 314 | + /* the server is ready to accept data! |
| 315 | + * according to rfc 821 we should not send more than 1000 |
| 316 | + * including the CRLF |
| 317 | + * characters on a single line so we will break the data up |
| 318 | + * into lines by \r and/or \n then if needed we will break |
| 319 | + * each of those into smaller lines to fit within the limit. |
| 320 | + * in addition we will be looking for lines that start with |
| 321 | + * a period '.' and append and additional period '.' to that |
| 322 | + * line. NOTE: this does not count towards are limit. |
| 323 | + */ |
| 324 | + |
| 325 | + // normalize the line breaks so we know the explode works |
| 326 | + $msg_data = str_replace("\r\n","\n",$msg_data); |
| 327 | + $msg_data = str_replace("\r","\n",$msg_data); |
| 328 | + $lines = explode("\n",$msg_data); |
| 329 | + |
| 330 | + /* we need to find a good way to determine is headers are |
| 331 | + * in the msg_data or if it is a straight msg body |
| 332 | + * currently I am assuming rfc 822 definitions of msg headers |
| 333 | + * and if the first field of the first line (':' sperated) |
| 334 | + * does not contain a space then it _should_ be a header |
| 335 | + * and we can process all lines before a blank "" line as |
| 336 | + * headers. |
| 337 | + */ |
| 338 | + $field = substr($lines[0],0,strpos($lines[0],":")); |
| 339 | + $in_headers = false; |
| 340 | + if(!empty($field) && !strstr($field," ")) { |
| 341 | + $in_headers = true; |
| 342 | + } |
| 343 | + |
| 344 | + $max_line_length = 998; // used below; set here for ease in change |
| 345 | + |
| 346 | + while(list(,$line) = @each($lines)) { |
| 347 | + $lines_out = null; |
| 348 | + if($line == "" && $in_headers) { |
| 349 | + $in_headers = false; |
| 350 | + } |
| 351 | + // ok we need to break this line up into several smaller lines |
| 352 | + while(strlen($line) > $max_line_length) { |
| 353 | + $pos = strrpos(substr($line,0,$max_line_length)," "); |
| 354 | + |
| 355 | + // Patch to fix DOS attack |
| 356 | + if(!$pos) { |
| 357 | + $pos = $max_line_length - 1; |
| 358 | + } |
| 359 | + |
| 360 | + $lines_out[] = substr($line,0,$pos); |
| 361 | + $line = substr($line,$pos + 1); |
| 362 | + /* if we are processing headers we need to |
| 363 | + * add a LWSP-char to the front of the new line |
| 364 | + * rfc 822 on long msg headers |
| 365 | + */ |
| 366 | + if($in_headers) { |
| 367 | + $line = "\t" . $line; |
| 368 | + } |
| 369 | + } |
| 370 | + $lines_out[] = $line; |
| 371 | + |
| 372 | + // now send the lines to the server |
| 373 | + while(list(,$line_out) = @each($lines_out)) { |
| 374 | + if(strlen($line_out) > 0) |
| 375 | + { |
| 376 | + if(substr($line_out, 0, 1) == ".") { |
| 377 | + $line_out = "." . $line_out; |
| 378 | + } |
| 379 | + } |
| 380 | + fputs($this->smtp_conn,$line_out . $this->CRLF); |
| 381 | + } |
| 382 | + } |
| 383 | + |
| 384 | + // ok all the message data has been sent so lets get this |
| 385 | + // over with aleady |
| 386 | + fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF); |
| 387 | + |
| 388 | + $rply = $this->get_lines(); |
| 389 | + $code = substr($rply,0,3); |
| 390 | + |
| 391 | + if($this->do_debug >= 2) { |
| 392 | + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
| 393 | + } |
| 394 | + |
| 395 | + if($code != 250) { |
| 396 | + $this->error = |
| 397 | + array("error" => "DATA not accepted from server", |
| 398 | + "smtp_code" => $code, |
| 399 | + "smtp_msg" => substr($rply,4)); |
| 400 | + if($this->do_debug >= 1) { |
| 401 | + echo "SMTP -> ERROR: " . $this->error["error"] . |
| 402 | + ": " . $rply . $this->CRLF; |
| 403 | + } |
| 404 | + return false; |
| 405 | + } |
| 406 | + return true; |
| 407 | + } |
| 408 | + |
| 409 | + /** |
| 410 | + * Expand takes the name and asks the server to list all the |
| 411 | + * people who are members of the _list_. Expand will return |
| 412 | + * back and array of the result or false if an error occurs. |
| 413 | + * Each value in the array returned has the format of: |
| 414 | + * [ <full-name> <sp> ] <path> |
| 415 | + * The definition of <path> is defined in rfc 821 |
| 416 | + * |
| 417 | + * Implements rfc 821: EXPN <SP> <string> <CRLF> |
| 418 | + * |
| 419 | + * SMTP CODE SUCCESS: 250 |
| 420 | + * SMTP CODE FAILURE: 550 |
| 421 | + * SMTP CODE ERROR : 500,501,502,504,421 |
| 422 | + * @access public |
| 423 | + * @return string array |
| 424 | + */ |
| 425 | + function Expand($name) { |
| 426 | + $this->error = null; // so no confusion is caused |
| 427 | + |
| 428 | + if(!$this->connected()) { |
| 429 | + $this->error = array( |
| 430 | + "error" => "Called Expand() without being connected"); |
| 431 | + return false; |
| 432 | + } |
| 433 | + |
| 434 | + fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF); |
| 435 | + |
| 436 | + $rply = $this->get_lines(); |
| 437 | + $code = substr($rply,0,3); |
| 438 | + |
| 439 | + if($this->do_debug >= 2) { |
| 440 | + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
| 441 | + } |
| 442 | + |
| 443 | + if($code != 250) { |
| 444 | + $this->error = |
| 445 | + array("error" => "EXPN not accepted from server", |
| 446 | + "smtp_code" => $code, |
| 447 | + "smtp_msg" => substr($rply,4)); |
| 448 | + if($this->do_debug >= 1) { |
| 449 | + echo "SMTP -> ERROR: " . $this->error["error"] . |
| 450 | + ": " . $rply . $this->CRLF; |
| 451 | + } |
| 452 | + return false; |
| 453 | + } |
| 454 | + |
| 455 | + // parse the reply and place in our array to return to user |
| 456 | + $entries = explode($this->CRLF,$rply); |
| 457 | + while(list(,$l) = @each($entries)) { |
| 458 | + $list[] = substr($l,4); |
| 459 | + } |
| 460 | + |
| 461 | + return $list; |
| 462 | + } |
| 463 | + |
| 464 | + /** |
| 465 | + * Sends the HELO command to the smtp server. |
| 466 | + * This makes sure that we and the server are in |
| 467 | + * the same known state. |
| 468 | + * |
| 469 | + * Implements from rfc 821: HELO <SP> <domain> <CRLF> |
| 470 | + * |
| 471 | + * SMTP CODE SUCCESS: 250 |
| 472 | + * SMTP CODE ERROR : 500, 501, 504, 421 |
| 473 | + * @access public |
| 474 | + * @return bool |
| 475 | + */ |
| 476 | + function Hello($host="") { |
| 477 | + $this->error = null; // so no confusion is caused |
| 478 | + |
| 479 | + if(!$this->connected()) { |
| 480 | + $this->error = array( |
| 481 | + "error" => "Called Hello() without being connected"); |
| 482 | + return false; |
| 483 | + } |
| 484 | + |
| 485 | + // if a hostname for the HELO was not specified determine |
| 486 | + //a suitable one to send |
| 487 | + if(empty($host)) { |
| 488 | + // we need to determine some sort of appopiate default |
| 489 | + // to send to the server |
| 490 | + $host = "localhost"; |
| 491 | + } |
| 492 | + |
| 493 | + // Send extended hello first (RFC 2821) |
| 494 | + if(!$this->SendHello("EHLO", $host)) |
| 495 | + { |
| 496 | + if(!$this->SendHello("HELO", $host)) |
| 497 | + return false; |
| 498 | + } |
| 499 | + |
| 500 | + return true; |
| 501 | + } |
| 502 | + |
| 503 | + /** |
| 504 | + * Sends a HELO/EHLO command. |
| 505 | + * @access private |
| 506 | + * @return bool |
| 507 | + */ |
| 508 | + function SendHello($hello, $host) { |
| 509 | + fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF); |
| 510 | + |
| 511 | + $rply = $this->get_lines(); |
| 512 | + $code = substr($rply,0,3); |
| 513 | + |
| 514 | + if($this->do_debug >= 2) { |
| 515 | + echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply; |
| 516 | + } |
| 517 | + |
| 518 | + if($code != 250) { |
| 519 | + $this->error = |
| 520 | + array("error" => $hello . " not accepted from server", |
| 521 | + "smtp_code" => $code, |
| 522 | + "smtp_msg" => substr($rply,4)); |
| 523 | + if($this->do_debug >= 1) { |
| 524 | + echo "SMTP -> ERROR: " . $this->error["error"] . |
| 525 | + ": " . $rply . $this->CRLF; |
| 526 | + } |
| 527 | + return false; |
| 528 | + } |
| 529 | + |
| 530 | + $this->helo_rply = $rply; |
| 531 | + |
| 532 | + return true; |
| 533 | + } |
| 534 | + |
| 535 | + /** |
| 536 | + * Gets help information on the keyword specified. If the keyword |
| 537 | + * is not specified then returns generic help, ussually contianing |
| 538 | + * A list of keywords that help is available on. This function |
| 539 | + * returns the results back to the user. It is up to the user to |
| 540 | + * handle the returned data. If an error occurs then false is |
| 541 | + * returned with $this->error set appropiately. |
| 542 | + * |
| 543 | + * Implements rfc 821: HELP [ <SP> <string> ] <CRLF> |
| 544 | + * |
| 545 | + * SMTP CODE SUCCESS: 211,214 |
| 546 | + * SMTP CODE ERROR : 500,501,502,504,421 |
| 547 | + * @access public |
| 548 | + * @return string |
| 549 | + */ |
| 550 | + function Help($keyword="") { |
| 551 | + $this->error = null; // to avoid confusion |
| 552 | + |
| 553 | + if(!$this->connected()) { |
| 554 | + $this->error = array( |
| 555 | + "error" => "Called Help() without being connected"); |
| 556 | + return false; |
| 557 | + } |
| 558 | + |
| 559 | + $extra = ""; |
| 560 | + if(!empty($keyword)) { |
| 561 | + $extra = " " . $keyword; |
| 562 | + } |
| 563 | + |
| 564 | + fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF); |
| 565 | + |
| 566 | + $rply = $this->get_lines(); |
| 567 | + $code = substr($rply,0,3); |
| 568 | + |
| 569 | + if($this->do_debug >= 2) { |
| 570 | + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
| 571 | + } |
| 572 | + |
| 573 | + if($code != 211 && $code != 214) { |
| 574 | + $this->error = |
| 575 | + array("error" => "HELP not accepted from server", |
| 576 | + "smtp_code" => $code, |
| 577 | + "smtp_msg" => substr($rply,4)); |
| 578 | + if($this->do_debug >= 1) { |
| 579 | + echo "SMTP -> ERROR: " . $this->error["error"] . |
| 580 | + ": " . $rply . $this->CRLF; |
| 581 | + } |
| 582 | + return false; |
| 583 | + } |
| 584 | + |
| 585 | + return $rply; |
| 586 | + } |
| 587 | + |
| 588 | + /** |
| 589 | + * Starts a mail transaction from the email address specified in |
| 590 | + * $from. Returns true if successful or false otherwise. If True |
| 591 | + * the mail transaction is started and then one or more Recipient |
| 592 | + * commands may be called followed by a Data command. |
| 593 | + * |
| 594 | + * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF> |
| 595 | + * |
| 596 | + * SMTP CODE SUCCESS: 250 |
| 597 | + * SMTP CODE SUCCESS: 552,451,452 |
| 598 | + * SMTP CODE SUCCESS: 500,501,421 |
| 599 | + * @access public |
| 600 | + * @return bool |
| 601 | + */ |
| 602 | + function Mail($from) { |
| 603 | + $this->error = null; // so no confusion is caused |
| 604 | + |
| 605 | + if(!$this->connected()) { |
| 606 | + $this->error = array( |
| 607 | + "error" => "Called Mail() without being connected"); |
| 608 | + return false; |
| 609 | + } |
| 610 | + |
| 611 | + $useVerp = ($this->do_verp ? "XVERP" : ""); |
| 612 | + fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF); |
| 613 | + |
| 614 | + $rply = $this->get_lines(); |
| 615 | + $code = substr($rply,0,3); |
| 616 | + |
| 617 | + if($this->do_debug >= 2) { |
| 618 | + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
| 619 | + } |
| 620 | + |
| 621 | + if($code != 250) { |
| 622 | + $this->error = |
| 623 | + array("error" => "MAIL not accepted from server", |
| 624 | + "smtp_code" => $code, |
| 625 | + "smtp_msg" => substr($rply,4)); |
| 626 | + if($this->do_debug >= 1) { |
| 627 | + echo "SMTP -> ERROR: " . $this->error["error"] . |
| 628 | + ": " . $rply . $this->CRLF; |
| 629 | + } |
| 630 | + return false; |
| 631 | + } |
| 632 | + return true; |
| 633 | + } |
| 634 | + |
| 635 | + /** |
| 636 | + * Sends the command NOOP to the SMTP server. |
| 637 | + * |
| 638 | + * Implements from rfc 821: NOOP <CRLF> |
| 639 | + * |
| 640 | + * SMTP CODE SUCCESS: 250 |
| 641 | + * SMTP CODE ERROR : 500, 421 |
| 642 | + * @access public |
| 643 | + * @return bool |
| 644 | + */ |
| 645 | + function Noop() { |
| 646 | + $this->error = null; // so no confusion is caused |
| 647 | + |
| 648 | + if(!$this->connected()) { |
| 649 | + $this->error = array( |
| 650 | + "error" => "Called Noop() without being connected"); |
| 651 | + return false; |
| 652 | + } |
| 653 | + |
| 654 | + fputs($this->smtp_conn,"NOOP" . $this->CRLF); |
| 655 | + |
| 656 | + $rply = $this->get_lines(); |
| 657 | + $code = substr($rply,0,3); |
| 658 | + |
| 659 | + if($this->do_debug >= 2) { |
| 660 | + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
| 661 | + } |
| 662 | + |
| 663 | + if($code != 250) { |
| 664 | + $this->error = |
| 665 | + array("error" => "NOOP not accepted from server", |
| 666 | + "smtp_code" => $code, |
| 667 | + "smtp_msg" => substr($rply,4)); |
| 668 | + if($this->do_debug >= 1) { |
| 669 | + echo "SMTP -> ERROR: " . $this->error["error"] . |
| 670 | + ": " . $rply . $this->CRLF; |
| 671 | + } |
| 672 | + return false; |
| 673 | + } |
| 674 | + return true; |
| 675 | + } |
| 676 | + |
| 677 | + /** |
| 678 | + * Sends the quit command to the server and then closes the socket |
| 679 | + * if there is no error or the $close_on_error argument is true. |
| 680 | + * |
| 681 | + * Implements from rfc 821: QUIT <CRLF> |
| 682 | + * |
| 683 | + * SMTP CODE SUCCESS: 221 |
| 684 | + * SMTP CODE ERROR : 500 |
| 685 | + * @access public |
| 686 | + * @return bool |
| 687 | + */ |
| 688 | + function Quit($close_on_error=true) { |
| 689 | + $this->error = null; // so there is no confusion |
| 690 | + |
| 691 | + if(!$this->connected()) { |
| 692 | + $this->error = array( |
| 693 | + "error" => "Called Quit() without being connected"); |
| 694 | + return false; |
| 695 | + } |
| 696 | + |
| 697 | + // send the quit command to the server |
| 698 | + fputs($this->smtp_conn,"quit" . $this->CRLF); |
| 699 | + |
| 700 | + // get any good-bye messages |
| 701 | + $byemsg = $this->get_lines(); |
| 702 | + |
| 703 | + if($this->do_debug >= 2) { |
| 704 | + echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg; |
| 705 | + } |
| 706 | + |
| 707 | + $rval = true; |
| 708 | + $e = null; |
| 709 | + |
| 710 | + $code = substr($byemsg,0,3); |
| 711 | + if($code != 221) { |
| 712 | + // use e as a tmp var cause Close will overwrite $this->error |
| 713 | + $e = array("error" => "SMTP server rejected quit command", |
| 714 | + "smtp_code" => $code, |
| 715 | + "smtp_rply" => substr($byemsg,4)); |
| 716 | + $rval = false; |
| 717 | + if($this->do_debug >= 1) { |
| 718 | + echo "SMTP -> ERROR: " . $e["error"] . ": " . |
| 719 | + $byemsg . $this->CRLF; |
| 720 | + } |
| 721 | + } |
| 722 | + |
| 723 | + if(empty($e) || $close_on_error) { |
| 724 | + $this->Close(); |
| 725 | + } |
| 726 | + |
| 727 | + return $rval; |
| 728 | + } |
| 729 | + |
| 730 | + /** |
| 731 | + * Sends the command RCPT to the SMTP server with the TO: argument of $to. |
| 732 | + * Returns true if the recipient was accepted false if it was rejected. |
| 733 | + * |
| 734 | + * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF> |
| 735 | + * |
| 736 | + * SMTP CODE SUCCESS: 250,251 |
| 737 | + * SMTP CODE FAILURE: 550,551,552,553,450,451,452 |
| 738 | + * SMTP CODE ERROR : 500,501,503,421 |
| 739 | + * @access public |
| 740 | + * @return bool |
| 741 | + */ |
| 742 | + function Recipient($to) { |
| 743 | + $this->error = null; // so no confusion is caused |
| 744 | + |
| 745 | + if(!$this->connected()) { |
| 746 | + $this->error = array( |
| 747 | + "error" => "Called Recipient() without being connected"); |
| 748 | + return false; |
| 749 | + } |
| 750 | + |
| 751 | + fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF); |
| 752 | + |
| 753 | + $rply = $this->get_lines(); |
| 754 | + $code = substr($rply,0,3); |
| 755 | + |
| 756 | + if($this->do_debug >= 2) { |
| 757 | + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
| 758 | + } |
| 759 | + |
| 760 | + if($code != 250 && $code != 251) { |
| 761 | + $this->error = |
| 762 | + array("error" => "RCPT not accepted from server", |
| 763 | + "smtp_code" => $code, |
| 764 | + "smtp_msg" => substr($rply,4)); |
| 765 | + if($this->do_debug >= 1) { |
| 766 | + echo "SMTP -> ERROR: " . $this->error["error"] . |
| 767 | + ": " . $rply . $this->CRLF; |
| 768 | + } |
| 769 | + return false; |
| 770 | + } |
| 771 | + return true; |
| 772 | + } |
| 773 | + |
| 774 | + /** |
| 775 | + * Sends the RSET command to abort and transaction that is |
| 776 | + * currently in progress. Returns true if successful false |
| 777 | + * otherwise. |
| 778 | + * |
| 779 | + * Implements rfc 821: RSET <CRLF> |
| 780 | + * |
| 781 | + * SMTP CODE SUCCESS: 250 |
| 782 | + * SMTP CODE ERROR : 500,501,504,421 |
| 783 | + * @access public |
| 784 | + * @return bool |
| 785 | + */ |
| 786 | + function Reset() { |
| 787 | + $this->error = null; // so no confusion is caused |
| 788 | + |
| 789 | + if(!$this->connected()) { |
| 790 | + $this->error = array( |
| 791 | + "error" => "Called Reset() without being connected"); |
| 792 | + return false; |
| 793 | + } |
| 794 | + |
| 795 | + fputs($this->smtp_conn,"RSET" . $this->CRLF); |
| 796 | + |
| 797 | + $rply = $this->get_lines(); |
| 798 | + $code = substr($rply,0,3); |
| 799 | + |
| 800 | + if($this->do_debug >= 2) { |
| 801 | + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
| 802 | + } |
| 803 | + |
| 804 | + if($code != 250) { |
| 805 | + $this->error = |
| 806 | + array("error" => "RSET failed", |
| 807 | + "smtp_code" => $code, |
| 808 | + "smtp_msg" => substr($rply,4)); |
| 809 | + if($this->do_debug >= 1) { |
| 810 | + echo "SMTP -> ERROR: " . $this->error["error"] . |
| 811 | + ": " . $rply . $this->CRLF; |
| 812 | + } |
| 813 | + return false; |
| 814 | + } |
| 815 | + |
| 816 | + return true; |
| 817 | + } |
| 818 | + |
| 819 | + /** |
| 820 | + * Starts a mail transaction from the email address specified in |
| 821 | + * $from. Returns true if successful or false otherwise. If True |
| 822 | + * the mail transaction is started and then one or more Recipient |
| 823 | + * commands may be called followed by a Data command. This command |
| 824 | + * will send the message to the users terminal if they are logged |
| 825 | + * in. |
| 826 | + * |
| 827 | + * Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF> |
| 828 | + * |
| 829 | + * SMTP CODE SUCCESS: 250 |
| 830 | + * SMTP CODE SUCCESS: 552,451,452 |
| 831 | + * SMTP CODE SUCCESS: 500,501,502,421 |
| 832 | + * @access public |
| 833 | + * @return bool |
| 834 | + */ |
| 835 | + function Send($from) { |
| 836 | + $this->error = null; // so no confusion is caused |
| 837 | + |
| 838 | + if(!$this->connected()) { |
| 839 | + $this->error = array( |
| 840 | + "error" => "Called Send() without being connected"); |
| 841 | + return false; |
| 842 | + } |
| 843 | + |
| 844 | + fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF); |
| 845 | + |
| 846 | + $rply = $this->get_lines(); |
| 847 | + $code = substr($rply,0,3); |
| 848 | + |
| 849 | + if($this->do_debug >= 2) { |
| 850 | + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
| 851 | + } |
| 852 | + |
| 853 | + if($code != 250) { |
| 854 | + $this->error = |
| 855 | + array("error" => "SEND not accepted from server", |
| 856 | + "smtp_code" => $code, |
| 857 | + "smtp_msg" => substr($rply,4)); |
| 858 | + if($this->do_debug >= 1) { |
| 859 | + echo "SMTP -> ERROR: " . $this->error["error"] . |
| 860 | + ": " . $rply . $this->CRLF; |
| 861 | + } |
| 862 | + return false; |
| 863 | + } |
| 864 | + return true; |
| 865 | + } |
| 866 | + |
| 867 | + /** |
| 868 | + * Starts a mail transaction from the email address specified in |
| 869 | + * $from. Returns true if successful or false otherwise. If True |
| 870 | + * the mail transaction is started and then one or more Recipient |
| 871 | + * commands may be called followed by a Data command. This command |
| 872 | + * will send the message to the users terminal if they are logged |
| 873 | + * in and send them an email. |
| 874 | + * |
| 875 | + * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF> |
| 876 | + * |
| 877 | + * SMTP CODE SUCCESS: 250 |
| 878 | + * SMTP CODE SUCCESS: 552,451,452 |
| 879 | + * SMTP CODE SUCCESS: 500,501,502,421 |
| 880 | + * @access public |
| 881 | + * @return bool |
| 882 | + */ |
| 883 | + function SendAndMail($from) { |
| 884 | + $this->error = null; // so no confusion is caused |
| 885 | + |
| 886 | + if(!$this->connected()) { |
| 887 | + $this->error = array( |
| 888 | + "error" => "Called SendAndMail() without being connected"); |
| 889 | + return false; |
| 890 | + } |
| 891 | + |
| 892 | + fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF); |
| 893 | + |
| 894 | + $rply = $this->get_lines(); |
| 895 | + $code = substr($rply,0,3); |
| 896 | + |
| 897 | + if($this->do_debug >= 2) { |
| 898 | + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
| 899 | + } |
| 900 | + |
| 901 | + if($code != 250) { |
| 902 | + $this->error = |
| 903 | + array("error" => "SAML not accepted from server", |
| 904 | + "smtp_code" => $code, |
| 905 | + "smtp_msg" => substr($rply,4)); |
| 906 | + if($this->do_debug >= 1) { |
| 907 | + echo "SMTP -> ERROR: " . $this->error["error"] . |
| 908 | + ": " . $rply . $this->CRLF; |
| 909 | + } |
| 910 | + return false; |
| 911 | + } |
| 912 | + return true; |
| 913 | + } |
| 914 | + |
| 915 | + /** |
| 916 | + * Starts a mail transaction from the email address specified in |
| 917 | + * $from. Returns true if successful or false otherwise. If True |
| 918 | + * the mail transaction is started and then one or more Recipient |
| 919 | + * commands may be called followed by a Data command. This command |
| 920 | + * will send the message to the users terminal if they are logged |
| 921 | + * in or mail it to them if they are not. |
| 922 | + * |
| 923 | + * Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF> |
| 924 | + * |
| 925 | + * SMTP CODE SUCCESS: 250 |
| 926 | + * SMTP CODE SUCCESS: 552,451,452 |
| 927 | + * SMTP CODE SUCCESS: 500,501,502,421 |
| 928 | + * @access public |
| 929 | + * @return bool |
| 930 | + */ |
| 931 | + function SendOrMail($from) { |
| 932 | + $this->error = null; // so no confusion is caused |
| 933 | + |
| 934 | + if(!$this->connected()) { |
| 935 | + $this->error = array( |
| 936 | + "error" => "Called SendOrMail() without being connected"); |
| 937 | + return false; |
| 938 | + } |
| 939 | + |
| 940 | + fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF); |
| 941 | + |
| 942 | + $rply = $this->get_lines(); |
| 943 | + $code = substr($rply,0,3); |
| 944 | + |
| 945 | + if($this->do_debug >= 2) { |
| 946 | + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
| 947 | + } |
| 948 | + |
| 949 | + if($code != 250) { |
| 950 | + $this->error = |
| 951 | + array("error" => "SOML not accepted from server", |
| 952 | + "smtp_code" => $code, |
| 953 | + "smtp_msg" => substr($rply,4)); |
| 954 | + if($this->do_debug >= 1) { |
| 955 | + echo "SMTP -> ERROR: " . $this->error["error"] . |
| 956 | + ": " . $rply . $this->CRLF; |
| 957 | + } |
| 958 | + return false; |
| 959 | + } |
| 960 | + return true; |
| 961 | + } |
| 962 | + |
| 963 | + /** |
| 964 | + * This is an optional command for SMTP that this class does not |
| 965 | + * support. This method is here to make the RFC821 Definition |
| 966 | + * complete for this class and __may__ be implimented in the future |
| 967 | + * |
| 968 | + * Implements from rfc 821: TURN <CRLF> |
| 969 | + * |
| 970 | + * SMTP CODE SUCCESS: 250 |
| 971 | + * SMTP CODE FAILURE: 502 |
| 972 | + * SMTP CODE ERROR : 500, 503 |
| 973 | + * @access public |
| 974 | + * @return bool |
| 975 | + */ |
| 976 | + function Turn() { |
| 977 | + $this->error = array("error" => "This method, TURN, of the SMTP ". |
| 978 | + "is not implemented"); |
| 979 | + if($this->do_debug >= 1) { |
| 980 | + echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF; |
| 981 | + } |
| 982 | + return false; |
| 983 | + } |
| 984 | + |
| 985 | + /** |
| 986 | + * Verifies that the name is recognized by the server. |
| 987 | + * Returns false if the name could not be verified otherwise |
| 988 | + * the response from the server is returned. |
| 989 | + * |
| 990 | + * Implements rfc 821: VRFY <SP> <string> <CRLF> |
| 991 | + * |
| 992 | + * SMTP CODE SUCCESS: 250,251 |
| 993 | + * SMTP CODE FAILURE: 550,551,553 |
| 994 | + * SMTP CODE ERROR : 500,501,502,421 |
| 995 | + * @access public |
| 996 | + * @return int |
| 997 | + */ |
| 998 | + function Verify($name) { |
| 999 | + $this->error = null; // so no confusion is caused |
| 1000 | + |
| 1001 | + if(!$this->connected()) { |
| 1002 | + $this->error = array( |
| 1003 | + "error" => "Called Verify() without being connected"); |
| 1004 | + return false; |
| 1005 | + } |
| 1006 | + |
| 1007 | + fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF); |
| 1008 | + |
| 1009 | + $rply = $this->get_lines(); |
| 1010 | + $code = substr($rply,0,3); |
| 1011 | + |
| 1012 | + if($this->do_debug >= 2) { |
| 1013 | + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
| 1014 | + } |
| 1015 | + |
| 1016 | + if($code != 250 && $code != 251) { |
| 1017 | + $this->error = |
| 1018 | + array("error" => "VRFY failed on name '$name'", |
| 1019 | + "smtp_code" => $code, |
| 1020 | + "smtp_msg" => substr($rply,4)); |
| 1021 | + if($this->do_debug >= 1) { |
| 1022 | + echo "SMTP -> ERROR: " . $this->error["error"] . |
| 1023 | + ": " . $rply . $this->CRLF; |
| 1024 | + } |
| 1025 | + return false; |
| 1026 | + } |
| 1027 | + return $rply; |
| 1028 | + } |
| 1029 | + |
| 1030 | + /******************************************************************* |
| 1031 | + * INTERNAL FUNCTIONS * |
| 1032 | + ******************************************************************/ |
| 1033 | + |
| 1034 | + /** |
| 1035 | + * Read in as many lines as possible |
| 1036 | + * either before eof or socket timeout occurs on the operation. |
| 1037 | + * With SMTP we can tell if we have more lines to read if the |
| 1038 | + * 4th character is '-' symbol. If it is a space then we don't |
| 1039 | + * need to read anything else. |
| 1040 | + * @access private |
| 1041 | + * @return string |
| 1042 | + */ |
| 1043 | + function get_lines() { |
| 1044 | + $data = ""; |
| 1045 | + while($str = @fgets($this->smtp_conn,515)) { |
| 1046 | + if($this->do_debug >= 4) { |
| 1047 | + echo "SMTP -> get_lines(): \$data was \"$data\"" . |
| 1048 | + $this->CRLF; |
| 1049 | + echo "SMTP -> get_lines(): \$str is \"$str\"" . |
| 1050 | + $this->CRLF; |
| 1051 | + } |
| 1052 | + $data .= $str; |
| 1053 | + if($this->do_debug >= 4) { |
| 1054 | + echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF; |
| 1055 | + } |
| 1056 | + // if the 4th character is a space then we are done reading |
| 1057 | + // so just break the loop |
| 1058 | + if(substr($str,3,1) == " ") { break; } |
| 1059 | + } |
| 1060 | + return $data; |
| 1061 | + } |
| 1062 | + |
| 1063 | +} |
| 1064 | + |
| 1065 | + |
| 1066 | + ?> |
Property changes on: trunk/extensions/EmailArticle/phpMailer_v2.1.0beta2/class.smtp.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 1067 | + native |
Index: trunk/extensions/EmailArticle/EmailArticle.alias.php |
— | — | @@ -0,0 +1,60 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Aliases for Special:EmailArticle |
| 5 | + * |
| 6 | + * @addtogroup Extensions |
| 7 | + */ |
| 8 | + |
| 9 | +$aliases = array(); |
| 10 | + |
| 11 | +/** English |
| 12 | + * @author Jon Harald Søby |
| 13 | + */ |
| 14 | +$aliases['en'] = array( |
| 15 | + 'EmailArticle' => array( 'EmailArticle' ), |
| 16 | +); |
| 17 | + |
| 18 | +/** Arabic (العربية) */ |
| 19 | +$aliases['ar'] = array( |
| 20 | + 'EmailArticle' => array( 'مراسلة المقالة' ), |
| 21 | +); |
| 22 | + |
| 23 | +/** Egyptian Spoken Arabic (مصرى) */ |
| 24 | +$aliases['arz'] = array( |
| 25 | + 'EmailArticle' => array( 'مراسلة المقالة' ), |
| 26 | +); |
| 27 | + |
| 28 | +/** French (Français) */ |
| 29 | +$aliases['fr'] = array( |
| 30 | + 'EmailArticle' => array( 'EnvoyerArticle', 'Envoyer Article', 'Envoyer l’article' ), |
| 31 | +); |
| 32 | + |
| 33 | +/** Hebrew (עברית) |
| 34 | + * @author Rotem Liss |
| 35 | + */ |
| 36 | +$aliases['he'] = array( |
| 37 | + 'EmailArticle' => array( 'שליחת_דף_בדואר' ), |
| 38 | +); |
| 39 | + |
| 40 | +/** Haitian (Kreyòl ayisyen) */ |
| 41 | +$aliases['ht'] = array( |
| 42 | + 'EmailArticle' => array( 'EmèlAtik' ), |
| 43 | +); |
| 44 | + |
| 45 | +/** Hungarian (Magyar) */ |
| 46 | +$aliases['hu'] = array( |
| 47 | + 'EmailArticle' => array( 'Szócikk elküldése e-mailben' ), |
| 48 | +); |
| 49 | + |
| 50 | +/** Dutch (Nederlands) */ |
| 51 | +$aliases['nl'] = array( |
| 52 | + 'EmailArticle' => array( 'PaginaE-mailen', 'PaginaEmailen' ), |
| 53 | +); |
| 54 | + |
| 55 | +/** Norwegian (bokmål) (Norsk (bokmål)) |
| 56 | + * @author Jon Harald Søby |
| 57 | + */ |
| 58 | +$aliases['no'] = array( |
| 59 | + 'EmailArticle' => array( 'Send_side_som_e-post' ), |
| 60 | +); |
| 61 | + |
Property changes on: trunk/extensions/EmailArticle/EmailArticle.alias.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 62 | + native |
Index: trunk/extensions/EmailArticle/EmailArticle_body.php |
— | — | @@ -0,0 +1,253 @@ |
| 2 | +<?php |
| 3 | +if (!defined('MEDIAWIKI')) die(); |
| 4 | + |
| 5 | +class SpecialEmailArticle extends SpecialPage { |
| 6 | + |
| 7 | + var $recipients = array(); |
| 8 | + var $title; |
| 9 | + var $subject; |
| 10 | + var $header; |
| 11 | + var $cat; |
| 12 | + var $group; |
| 13 | + var $list; |
| 14 | + var $textonly; |
| 15 | + var $css; |
| 16 | + |
| 17 | + public function __construct() { |
| 18 | + global $wgEmailArticleGroup; |
| 19 | + SpecialPage::SpecialPage('EmailArticle', $wgEmailArticleGroup); |
| 20 | + } |
| 21 | + |
| 22 | + /** |
| 23 | + * Override SpecialPage::execute($param = '') |
| 24 | + */ |
| 25 | + function execute($param) { |
| 26 | + global $wgOut, $wgUser, $wgEmailArticleContactsCat, $wgGroupPermissions, $wgSitename, $wgEmailArticleCss, $wgEmailArticleAllowAllUsers; |
| 27 | + $db =& wfGetDB(DB_SLAVE); |
| 28 | + $param = str_replace('_', ' ', $param); |
| 29 | + |
| 30 | + wfLoadExtensionMessages( 'EmailArticle' ); |
| 31 | + |
| 32 | + $this->setHeaders(); |
| 33 | + |
| 34 | + # Get info from request or set to defaults |
| 35 | + $this->title = isset($_REQUEST['ea-title']) ? $_REQUEST['ea-title'] : $param; |
| 36 | + $this->subject = isset($_REQUEST['ea-subject']) ? $_REQUEST['ea-subject'] : '' . wfMsg('ea-articlesend', $this->title, $wgSitename ); |
| 37 | + $this->header = isset($_REQUEST['ea-header']) ? $_REQUEST['ea-header'] : ''; |
| 38 | + $this->cat = isset($_REQUEST['ea-cat']) ? $_REQUEST['ea-cat'] : ''; |
| 39 | + $this->group = isset($_REQUEST['ea-group']) ? $_REQUEST['ea-group'] : ''; |
| 40 | + $this->list = isset($_REQUEST['ea-list']) ? $_REQUEST['ea-list'] : ''; |
| 41 | + $this->textonly = isset($_REQUEST['ea-textonly']) ? $_REQUEST['ea-textonly'] : false; |
| 42 | + $this->css = isset($_REQUEST['ea-css']) ? $_REQUEST['ea-css'] : $wgEmailArticleCss; |
| 43 | + |
| 44 | + # Bail if no article title to send has been specified |
| 45 | + if ($this->title) $wgOut->addWikiText(wfMsg('ea-heading', $this->title)); |
| 46 | + else return $wgOut->addWikiText(wfMsg('ea-noarticle')); |
| 47 | + |
| 48 | + # If the send button was clicked, attempt to send and exit |
| 49 | + if (isset($_REQUEST['ea-send'])) return $this->send(); |
| 50 | + |
| 51 | + # Render form |
| 52 | + $special = Title::makeTitle(NS_SPECIAL, 'EmailArticle'); |
| 53 | + $wgOut->addHTML(wfElement('form',array( |
| 54 | + 'class' => 'EmailArticle', |
| 55 | + 'action' => $special->getLocalURL('action=submit'), |
| 56 | + 'method' => 'POST' |
| 57 | + ),null)); |
| 58 | + $wgOut->addHTML('<fieldset><legend>'.wfMsg('ea-selectrecipients').'</legend>'); |
| 59 | + $wgOut->addHTML('<table style="padding:0;margin:0;border:none;">'); |
| 60 | + |
| 61 | + # If $wgEmailArticleContactsCat is set, create a select list of all categories |
| 62 | + if ($wgEmailArticleContactsCat) { |
| 63 | + $cats = ''; |
| 64 | + $result = $db->select( |
| 65 | + 'categorylinks', |
| 66 | + 'cl_from', |
| 67 | + 'cl_to = '.$db->addQuotes($wgEmailArticleContactsCat), |
| 68 | + __METHOD__, |
| 69 | + array('ORDER BY' => 'cl_sortkey') |
| 70 | + ); |
| 71 | + if ($result instanceof ResultWrapper) $result = $result->result; |
| 72 | + if ($result) while ($row = $db->fetchRow($result)) { |
| 73 | + $t = Title::newFromID($row[0]); |
| 74 | + if ($t->getNamespace() == NS_CATEGORY) { |
| 75 | + $cat = $t->getText(); |
| 76 | + $selected = $cat == $this->cat ? ' selected' : ''; |
| 77 | + $cats .= "<option$selected>$cat</option>"; |
| 78 | + } |
| 79 | + } |
| 80 | + if ($cats) $wgOut->addHTML("<tr><td>From category:</td><td><select name=\"ea-cat\"><option/>$cats</select></td></tr>\n"); |
| 81 | + } |
| 82 | + |
| 83 | + # Allow selection of a group |
| 84 | + $groups = '<option/>'; |
| 85 | + foreach (array_keys($wgGroupPermissions) as $group) if ($group != '*') { |
| 86 | + $selected = $group == $this->group ? ' selected' : ''; |
| 87 | + if ($wgEmailArticleAllowAllUsers || $group != 'user') $groups .= "<option$selected>$group</option>"; |
| 88 | + } |
| 89 | + $wgOut->addHTML("<tr><td>".wfMsg('ea-fromgroup')."</td><td><select name=\"ea-group\">$groups</select></td></tr>\n"); |
| 90 | + $wgOut->addHTML('</table>'); |
| 91 | + |
| 92 | + # Addition of named list |
| 93 | + $wgOut->addWikiText(wfMsg('ea-selectlist')); |
| 94 | + $wgOut->addHTML("<textarea name=\"ea-list\" rows=\"5\">{$this->list}</textarea><br />\n"); |
| 95 | + $wgOut->addHTML('</fieldset>'); |
| 96 | + |
| 97 | + $wgOut->addHTML('<fieldset><legend>'.wfMsg('ea-compose').'</legend>'); |
| 98 | + |
| 99 | + # Subject |
| 100 | + $wgOut->addWikiText(wfMsg('ea-subject')); |
| 101 | + $wgOut->addHTML(wfElement('input',array('type' => 'text', 'name' => 'ea-subject', 'value' => $this->subject, 'style' => "width:100%"))); |
| 102 | + |
| 103 | + # Header |
| 104 | + $wgOut->addWikiText(wfMsg('ea-header')); |
| 105 | + $wgOut->addHTML("<textarea name=\"ea-header\" rows=\"5\">{$this->header}</textarea><br />\n"); |
| 106 | + |
| 107 | + # CSS |
| 108 | + $csss = ''; |
| 109 | + $result = $db->select( |
| 110 | + 'page', |
| 111 | + 'page_id', |
| 112 | + 'page_title LIKE \'%.css\'', |
| 113 | + __METHOD__, |
| 114 | + array('ORDER BY' => 'page_title') |
| 115 | + ); |
| 116 | + if ($result instanceof ResultWrapper) $result = $result->result; |
| 117 | + if ($result) while ($row = $db->fetchRow($result)) { |
| 118 | + $t = Title::newFromID($row[0])->getPrefixedText(); |
| 119 | + $selected = $t == $this->css ? ' selected' : ''; |
| 120 | + $csss .= "<option$selected>$t</option>"; |
| 121 | + } |
| 122 | + if ($csss) { |
| 123 | + $wgOut->addWikiText(wfMsg('ea-selectcss')); |
| 124 | + $wgOut->addHTML("<select name=\"ea-css\"><option/>$csss</select>\n"); |
| 125 | + } |
| 126 | + |
| 127 | + $wgOut->addHTML("</fieldset>"); |
| 128 | + |
| 129 | + # Submit buttons & hidden values |
| 130 | + $wgOut->addHTML(wfElement('input', array('type' => 'submit', 'name' => 'ea-send', 'value' => wfMsg('ea-send')))); |
| 131 | + $wgOut->addHTML(wfElement('input', array('type' => 'submit', 'name' => 'ea-show', 'value' => wfMsg('ea-show')))); |
| 132 | + $wgOut->addHTML(wfElement('input', array('type' => 'hidden', 'name' => 'ea-title', 'value' => $this->title))); |
| 133 | + |
| 134 | + $wgOut->addHTML('</form>'); |
| 135 | + |
| 136 | + # If the show button was clicked, render the list |
| 137 | + if (isset($_REQUEST['ea-show'])) return $this->send(false); |
| 138 | + } |
| 139 | + |
| 140 | + # Send the message to the recipients (or just list them if arg = false) |
| 141 | + function send($send = true) { |
| 142 | + global $wgOut, $wgUser, $wgParser, $wgServer, $wgScript, $wgArticlePath, $wgScriptPath, |
| 143 | + $wgEmailArticleCss, $wgEmailArticleGroup, $wgEmailArticleAllowRemoteAddr, $wgEmailArticleAllowAllUsers; |
| 144 | + |
| 145 | + # Set error and bail if user not in postmaster group, and request not from trusted address |
| 146 | + if ($wgEmailArticleGroup && !in_array($wgEmailArticleGroup, $wgUser->getGroups()) && !in_array($_SERVER['REMOTE_ADDR'], $wgEmailArticleAllowRemoteAddr)) { |
| 147 | + $denied = wfMsg('ea-denied'); |
| 148 | + $wgOut->addWikiText(wfMsg('ea-error', $this->title, $denied )); |
| 149 | + return false; |
| 150 | + } |
| 151 | + |
| 152 | + $db = &wfGetDB(DB_SLAVE); |
| 153 | + $title = Title::newFromText($this->title); |
| 154 | + $opt = new ParserOptions; |
| 155 | + |
| 156 | + # Get contact article titles from selected cat |
| 157 | + if ($this->cat) { |
| 158 | + $result = $db->select( |
| 159 | + 'categorylinks', |
| 160 | + 'cl_from', |
| 161 | + 'cl_to = '.$db->addQuotes($this->cat), |
| 162 | + __METHOD__, |
| 163 | + array('ORDER BY' => 'cl_sortkey') |
| 164 | + ); |
| 165 | + if ($result instanceof ResultWrapper) $result = $result->result; |
| 166 | + if ($result) while ($row = $db->fetchRow($result)) $this->addRecipient(Title::newFromID($row[0])); |
| 167 | + } |
| 168 | + |
| 169 | + # Get email addresses from users in selected group |
| 170 | + if ($this->group && ($wgEmailArticleAllowAllUsers || $this->group != 'user')) { |
| 171 | + $group = $db->addQuotes($this->group); |
| 172 | + $result = $this->group == 'user' |
| 173 | + ? $db->select('user', 'user_email', 'user_email != \'\'', __METHOD__) |
| 174 | + : $db->select(array('user', 'user_groups'), 'user_email', "ug_user = user_id AND ug_group = $group", __METHOD__); |
| 175 | + if ($result instanceof ResultWrapper) $result = $result->result; |
| 176 | + if ($result) while ($row = $db->fetchRow($result)) $this->addRecipient($row[0]); |
| 177 | + } |
| 178 | + |
| 179 | + # Recipients from list (expand templates in wikitext) |
| 180 | + $list = $wgParser->preprocess($this->list, $title, $opt); |
| 181 | + foreach (preg_split("/[\\x00-\\x1f,;*]+/", $list) as $item) $this->addRecipient($item); |
| 182 | + |
| 183 | + # Compose the wikitext content of the article to send |
| 184 | + $article = new Article($title); |
| 185 | + $message = $article->getContent(); |
| 186 | + if ($this->header) $message = "{$this->header}\n\n$message"; |
| 187 | + |
| 188 | + # Convert the message text to html unless textonly |
| 189 | + if ($this->textonly == '') { |
| 190 | + |
| 191 | + # Parse the wikitext using absolute URL's for local article links |
| 192 | + $tmp = array($wgArticlePath, $wgScriptPath, $wgScript); |
| 193 | + $wgArticlePath = $wgServer.$wgArticlePath; |
| 194 | + $wgScriptPath = $wgServer.$wgScriptPath; |
| 195 | + $wgScript = $wgServer.$wgScript; |
| 196 | + $message = $wgParser->parse($message, $title, $opt, true, true)->getText(); |
| 197 | + list($wgArticlePath,$wgScriptPath,$wgScript) = $tmp; |
| 198 | + |
| 199 | + # Get CSS content if any |
| 200 | + if ($this->css) { |
| 201 | + $article = new Article(Title::newFromText($this->css)); |
| 202 | + $css = '<style type="text/css">'.$article->getContent().'</style>'; |
| 203 | + } |
| 204 | + |
| 205 | + # Create a html wrapper for the message |
| 206 | + $head = "<head>$css</head>"; |
| 207 | + $message = "<html>$head<body style=\"margin:10px\"><div id=\"#bodyContent\">$message</div></body></html>"; |
| 208 | + |
| 209 | + } |
| 210 | + |
| 211 | + # Send message or list recipients |
| 212 | + $count = count($this->recipients); |
| 213 | + if ($count > 0) { |
| 214 | + |
| 215 | + # Set up new mailer instance if sending |
| 216 | + if ($send) { |
| 217 | + $mail = new PHPMailer(); |
| 218 | + $mail->From = $wgUser->isValidEmailAddr($wgUser->getEmail()) ? $wgUser->getEmail() : "wiki@$wgServer"; |
| 219 | + $mail->FromName = User::whoIsReal($wgUser->getId()); |
| 220 | + $mail->Subject = $this->subject; |
| 221 | + $mail->Body = $message; |
| 222 | + $mail->IsHTML(!$this->textonly); |
| 223 | + } |
| 224 | + else $msg = wfMsg('ea-listrecipients', $count); |
| 225 | + |
| 226 | + # Loop through recipients sending or adding to list |
| 227 | + foreach ($this->recipients as $recipient) $send ? $mail->AddAddress($recipient) : $msg .= "\n*[mailto:$recipient $recipient]"; |
| 228 | + |
| 229 | + if ($send) { |
| 230 | + if ($state = $mail->Send()) $msg = wfMsg('ea-sent', $this->title, $count, $wgUser->getName()); |
| 231 | + else $msg = wfMsg('ea-error', $this->title, $mail->ErrorInfo); |
| 232 | + } |
| 233 | + else $state = $count; |
| 234 | + } |
| 235 | + else $msg = wfMsg('ea-error', $this->title, wfMsg('ea-norecipients')); |
| 236 | + |
| 237 | + $wgOut->addWikiText($msg); |
| 238 | + return $state; |
| 239 | + } |
| 240 | + |
| 241 | + /** |
| 242 | + * Add a recipient the list |
| 243 | + * - accepts title objects for article containing email address, or string of actual address |
| 244 | + */ |
| 245 | + function addRecipient($recipient) { |
| 246 | + if (is_object($recipient) && $recipient->exists()) { |
| 247 | + $article = new Article($recipient); |
| 248 | + if (preg_match('/[a-z0-9_.-]+@[a-z0-9_.-]+/i', $article->getContent(), $emails)) $recipient = $emails[0]; |
| 249 | + else $recipient = ''; |
| 250 | + } |
| 251 | + if ($valid = User::isValidEmailAddr($recipient)) $this->recipients[] = $recipient; |
| 252 | + return $valid; |
| 253 | + } |
| 254 | +} |
Property changes on: trunk/extensions/EmailArticle/EmailArticle_body.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 255 | + native |
Index: trunk/extensions/Translate/groups/mediawiki-defines.txt |
— | — | @@ -212,7 +212,7 @@ |
213 | 213 | |
214 | 214 | Email Address Image |
215 | 215 | |
216 | | -Email Page |
| 216 | +Email Article |
217 | 217 | descmsg = ea-desc |
218 | 218 | |
219 | 219 | Error Handler |
Index: trunk/extensions/Translate/aliases.txt |
— | — | @@ -34,8 +34,8 @@ |
35 | 35 | Edit user |
36 | 36 | file = EditUser/EditUser.alias.php |
37 | 37 | |
38 | | -Email page |
39 | | -file = EmailPage/EmailPage.alias.php |
| 38 | +Email article |
| 39 | +file = EmailArticle/EmailArticle.alias.php |
40 | 40 | |
41 | 41 | Eval |
42 | 42 | file = Eval/SpecialEval.alias.php |