fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [11296] Merge 11292:11295 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [11296] Merge 11292:11295 from trunk
Date: Tue, 17 Sep 2013 06:32:00 +0000

Revision: 11296
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11296
Author:   sigurdne
Date:     2013-09-17 06:31:57 +0000 (Tue, 17 Sep 2013)
Log Message:
-----------
Merge  11292:11295 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/admin/templates/base/config.tpl
    branches/Version-1_0-branch/phpgwapi/inc/class.mailer_smtp.inc.php
    branches/Version-1_0-branch/phpgwapi/inc/class.send.inc.php
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/LICENSE
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/README.md
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/changelog.md
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/class.phpmailer.php
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/class.pop3.php
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/class.smtp.php
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/docs/Note_for_SMTP_debugging.txt
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/docs/extending.html
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/docs/generatedocs.sh
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/docs/pop3_article.txt
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/code_generator.phps
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/exceptions.phps
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/gmail.phps
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/mail.phps
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/mailing_list.phps
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/pop_before_smtp.phps
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/sendmail.phps
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/smtp.phps
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/smtp_no_auth.phps
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/language/phpmailer.lang-cz.php
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/language/phpmailer.lang-fr.php
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/test/phpmailerLangTest.php
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/test/phpmailerTest.php
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/test/test_callback.php
    branches/Version-1_0-branch/property/inc/class.sobudget.inc.php

Added Paths:
-----------
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/PHPMailerAutoload.php
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/test/fakepopserver.sh
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/test/runfakepopserver.sh

Removed Paths:
-------------
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/changelog.txt
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/docs/use_gmail.txt
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/images/phpmailer.gif
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/test_db_smtp_basic.php
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/test_mail_advanced.php
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/test_mail_basic.php
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/test_pop_before_smtp_advanced.php
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/test_pop_before_smtp_basic.php
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/test_sendmail_advanced.php
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/test_sendmail_basic.php
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/test_smtp_advanced.php
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/test_smtp_advanced_no_auth.php
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/test_smtp_basic.php
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/test_smtp_basic_no_auth.php
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/test_smtp_gmail_advanced.php
    
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/examples/test_smtp_gmail_basic.php
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/test/contents.html
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/test/test.png
    branches/Version-1_0-branch/phpgwapi/inc/phpmailer/test/testemail.php

Property Changed:
----------------
    branches/Version-1_0-branch/


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871,9873-9893,9895,9897-9912,9914-9919,9921-9928,9930-9952,9954,9956,9958-9963,9965-9993,9995-9997,9999-10001,10003-10004,10006-10007,10009-10012,10014-10031,10033-10073,10075-10107,10109-10165,10167-10210,10222-10226,10228-10311,10313-10378,10380,10382,10384-10393,10395-10478,10480-10482,10484-10494,10496-10503,10505,10507,10509-10521,10523,10525-10528,10530-10540,10542-10543,10545-10568,10570-10584,10586-10590,10592-10594,10596,10598-10599,10601-10611,10613,10615,10617-10626,10628-10636,10638,10640-10654,10656-10658,10660,10662-10672,10674,10676-10682,10684,10686,10688-10690,10692-10694,10696-10697,10699-10701,10703,10705-10706,10708-10724,10726-10731,10734,10736-10748,10750-10796,10798-10939,10941,10943,10945,10947-10953,10955,10957-10961,10963,10965-10966,10968-11001,11003-11030,11032-11034,11036,11038,11040,11042-11053,11055-11059,11061-11062,11064-11068,11070-11073,11075-11077,11079-11083,11085,11087-11088,11090-11093,11095-11108,11110-11111,11113,11115-11116,11118-11120,11122,11124-11129,11131-11132,11134,11136,11138,11140-11151,11153-11161,11163-11185,11187-11189,11191-11229,11231,11233,11235-11264,11266-11267,11269-11278,11280-11282,11284-11291
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871,9873-9893,9895,9897-9912,9914-9919,9921-9928,9930-9952,9954,9956,9958-9963,9965-9993,9995-9997,9999-10001,10003-10004,10006-10007,10009-10012,10014-10031,10033-10073,10075-10107,10109-10165,10167-10210,10222-10226,10228-10311,10313-10378,10380,10382,10384-10393,10395-10478,10480-10482,10484-10494,10496-10503,10505,10507,10509-10521,10523,10525-10528,10530-10540,10542-10543,10545-10568,10570-10584,10586-10590,10592-10594,10596,10598-10599,10601-10611,10613,10615,10617-10626,10628-10636,10638,10640-10654,10656-10658,10660,10662-10672,10674,10676-10682,10684,10686,10688-10690,10692-10694,10696-10697,10699-10701,10703,10705-10706,10708-10724,10726-10731,10734,10736-10748,10750-10796,10798-10939,10941,10943,10945,10947-10953,10955,10957-10961,10963,10965-10966,10968-11001,11003-11030,11032-11034,11036,11038,11040,11042-11053,11055-11059,11061-11062,11064-11068,11070-11073,11075-11077,11079-11083,11085,11087-11088,11090-11093,11095-11108,11110-11111,11113,11115-11116,11118-11120,11122,11124-11129,11131-11132,11134,11136,11138,11140-11151,11153-11161,11163-11185,11187-11189,11191-11229,11231,11233,11235-11264,11266-11267,11269-11278,11280-11282,11284-11291,11293-11295

Modified: branches/Version-1_0-branch/admin/templates/base/config.tpl
===================================================================
--- branches/Version-1_0-branch/admin/templates/base/config.tpl 2013-09-16 
13:20:16 UTC (rev 11295)
+++ branches/Version-1_0-branch/admin/templates/base/config.tpl 2013-09-17 
06:31:57 UTC (rev 11296)
@@ -118,7 +118,31 @@
                        </select>
                </td>
        </tr>
+
+       <tr class="row_on">
+    <td>{lang_SMTPDebug}:</td>
+               <td>
+                       <select name="newsettings[SMTPDebug]">
+                               <option value="0">{lang_No}</option>
+                               <option 
value="1"{selected_SMTPDebug_1}>commands</option>
+                               <option 
value="2"{selected_SMTPDebug_2}>commands and data</option>
+                       </select>
+               </td>
+       </tr>
+
+       <tr class="row_off">
+    <td>{lang_Debugoutput}:</td>
+               <td>
+                       <select name="newsettings[Debugoutput]">
+                               <option value="echo">echo</option>
+                               <option 
value="html"{selected_Debugoutput_html}>html</option>
+                               <option 
value="errorlog"{selected_Debugoutput_errorlog}>error log</option>
+                       </select>
+               </td>
+       </tr>
        
+ 
+ 
    <tr class="th">
     <td colspan="2">&nbsp;<b>{lang_appearance}</b></td>
        </tr>

Modified: branches/Version-1_0-branch/phpgwapi/inc/class.mailer_smtp.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.mailer_smtp.inc.php  
2013-09-16 13:20:16 UTC (rev 11295)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.mailer_smtp.inc.php  
2013-09-17 06:31:57 UTC (rev 11296)
@@ -33,10 +33,47 @@
                        $this->PluginDir = PHPGW_INCLUDE_ROOT . 
'/phpgwapi/inc/phpmailer/';
                        $this->Host = 
$GLOBALS['phpgw_info']['server']['smtp_server'];
                        $this->Port = 
isset($GLOBALS['phpgw_info']['server']['smtp_port']) ? 
$GLOBALS['phpgw_info']['server']['smtp_port'] : 25;
-                       $this->SMTPAuth = 
isset($GLOBALS['phpgw_info']['server']['smtpAuth']) && 
$GLOBALS['phpgw_info']['server']['smtpAuth'] == yes ? true : false;
                        $this->SMTPSecure = 
isset($GLOBALS['phpgw_info']['server']['smtpSecure']) ? 
$GLOBALS['phpgw_info']['server']['smtpSecure'] : '';
-                       $this->Username = 
isset($GLOBALS['phpgw_info']['server']['smtpUser']) ? 
$GLOBALS['phpgw_info']['server']['smtpUser'] : '';
-                       $this->Password =  
isset($GLOBALS['phpgw_info']['server']['smtpPassword']) ? 
$GLOBALS['phpgw_info']['server']['smtpPassword'] : '';
                        $this->Version = 'custom - phpGroupWare 1.73';
+                       $this->CharSet = 'utf-8';
+ 
+                       if ( 
isset($GLOBALS['phpgw_info']['server']['smtpAuth']) && 
$GLOBALS['phpgw_info']['server']['smtpAuth'] == 'yes' )
+                       {
+                               $this->SMTPAuth = true;
+                               $this->Username = 
isset($GLOBALS['phpgw_info']['server']['smtpUser']) ? 
$GLOBALS['phpgw_info']['server']['smtpUser'] : '';
+                               $this->Password =  
isset($GLOBALS['phpgw_info']['server']['smtpPassword']) ? 
$GLOBALS['phpgw_info']['server']['smtpPassword'] : '';
+                       }
+                       
+                   /**
+                    * SMTP class debug output mode.
+                    * Options: 0 = off, 1 = commands, 2 = commands and data
+                    * @type int
+                    */
+
+                       if ( 
isset($GLOBALS['phpgw_info']['server']['SMTPDebug']) )
+                       {
+                           $this->SMTPDebug = 
(int)$GLOBALS['phpgw_info']['server']['SMTPDebug'];
+                       }
+
+                   /**
+                * The function/method to use for debugging output.
+                * Options: 'echo', 'html' or 'error_log'
+                * @type string
+                * @see SMTP::$Debugoutput
+                */
+
+                       if ( 
isset($GLOBALS['phpgw_info']['server']['Debugoutput']) && 
$GLOBALS['phpgw_info']['server']['smtpAuth'] != 'echo' )
+                       {
+                               switch 
($GLOBALS['phpgw_info']['server']['Debugoutput'])
+                               {
+                                       case 'html':
+                                       $this->Debugoutput =  'html';
+                                       break;
+                                       case 'errorlog':
+                                       $this->Debugoutput =  'error_log';
+                                       break;
+                               default:
+                               }
+                       }
                }
        }

Modified: branches/Version-1_0-branch/phpgwapi/inc/class.send.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.send.inc.php 2013-09-16 
13:20:16 UTC (rev 11295)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.send.inc.php 2013-09-17 
06:31:57 UTC (rev 11296)
@@ -157,16 +157,11 @@
                        $smtp->IsSMTP();
                        $smtp->Subject = $subject;
                        $smtp->Body    = $body;
-                       $smtp->AddCustomHeader('X-Mailer: phpGroupWare 
(http://www.phpgroupware.org)');
+                       $smtp->AddCustomHeader('X-Mailer: fmsystem 
(http://www.fmsystem.no)');
                        if($receive_notification)
                        {
                                
$smtp->AddCustomHeader("Disposition-Notification-To: {$smtp->From}");
                        }
-                       $smtp->Port = 
$GLOBALS['phpgw_info']['server']['smtp_port'] ? 
$GLOBALS['phpgw_info']['server']['smtp_port'] : 25;
-                       $smtp->Host     = 
$GLOBALS['phpgw_info']['server']['smtp_server'];
-                       $smtp->Encoding = '8bit';
-                       $smtp->CharSet = 'utf-8';
-                       $smtp->PluginDir = 
PHPGW_SERVER_ROOT."/phpgwapi/inc/phpmailer/";
 
                        if($content_type =='html')
                        {
@@ -192,13 +187,6 @@
                                }
                        }
 
-                       if ( $GLOBALS['phpgw_info']['server']['smtp_auth'] == 
'True' )
-                       {
-                               $smtp->SMTPAuth = true;
-                               $smtp->Username = 
$GLOBALS['phpgw_info']['server']['smtp_user'];
-                               $smtp->Password = 
$GLOBALS['phpgw_info']['server']['smtp_password'];
-                       }
-
                        // set a higher timeout for big messages
                        @set_time_limit(120);
                        #$smtp->SMTPDebug = 10;

Modified: branches/Version-1_0-branch/phpgwapi/inc/phpmailer/LICENSE
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/phpmailer/LICENSE  2013-09-16 
13:20:16 UTC (rev 11295)
+++ branches/Version-1_0-branch/phpgwapi/inc/phpmailer/LICENSE  2013-09-17 
06:31:57 UTC (rev 11296)
@@ -312,7 +312,7 @@
     from a designated place, offer equivalent access to copy the above
     specified materials from the same place.
 
-    e) Verify that the user has already received a copy of these
+    e) verify that the user has already received a copy of these
     materials or that you have already sent this user a copy.
 
   For an executable, the required form of the "work that uses the

Copied: 
branches/Version-1_0-branch/phpgwapi/inc/phpmailer/PHPMailerAutoload.php (from 
rev 11295, trunk/phpgwapi/inc/phpmailer/PHPMailerAutoload.php)
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/phpmailer/PHPMailerAutoload.php    
                        (rev 0)
+++ branches/Version-1_0-branch/phpgwapi/inc/phpmailer/PHPMailerAutoload.php    
2013-09-17 06:31:57 UTC (rev 11296)
@@ -0,0 +1,33 @@
+<?php
+/**
+ * PHPMailer SPL autoloader.
+ * PHP Version 5.0.0
+ * @package PHPMailer
+ * @link https://github.com/PHPMailer/PHPMailer/
+ * @author Marcus Bointon (coolbru) <address@hidden>
+ * @author Jim Jagielski (jimjag) <address@hidden>
+ * @author Andy Prevost (codeworxtech) <address@hidden>
+ * @author Brent R. Matzelle (original founder)
+ * @copyright 2013 Marcus Bointon
+ * @copyright 2010 - 2012 Jim Jagielski
+ * @copyright 2004 - 2009 Andy Prevost
+ * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public 
License
+ * @note This program is distributed in the hope that it will be useful - 
WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+/**
+ * PHPMailer SPL autoloader.
+ * @param string $classname The name of the class to load
+ */
+function PHPMailerAutoload($classname)
+{
+    //Can't use __DIR__ as it's only in PHP 5.3+
+    $filename = 
dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';
+    if (is_readable($filename)) {
+        require $filename;
+    }
+}
+
+spl_autoload_register('PHPMailerAutoload');

Modified: branches/Version-1_0-branch/phpgwapi/inc/phpmailer/README.md
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/phpmailer/README.md        
2013-09-16 13:20:16 UTC (rev 11295)
+++ branches/Version-1_0-branch/phpgwapi/inc/phpmailer/README.md        
2013-09-17 06:31:57 UTC (rev 11296)
@@ -7,7 +7,7 @@
 - Probably the world's most popular code for sending email from PHP!
 - Used by many open-source projects: Drupal, SugarCRM, Yii, Joomla! and many 
more
 - Integrated SMTP support - send without a local mail server
-- Send emails with multiple TOs, CCs, BCCs and REPLY-TOs
+- send emails with multiple TOs, CCs, BCCs and REPLY-TOs
 - Multipart/alternative emails for mail clients that do not read HTML email
 - Support for 8bit, base64, binary, and quoted-printable encoding
 - SMTP authentication with LOGIN, PLAIN, NTLM and CRAM-MD5 mechanisms
@@ -42,7 +42,7 @@
 
 $mail = new PHPMailer;
 
-$mail->IsSMTP();                                      // Set mailer to use SMTP
+$mail->isSMTP();                                      // Set mailer to use SMTP
 $mail->Host = 'smtp1.example.com;smtp2.example.com';  // Specify main and 
backup server
 $mail->SMTPAuth = true;                               // Enable SMTP 
authentication
 $mail->Username = 'jswan';                            // SMTP username
@@ -51,22 +51,22 @@
 
 $mail->From = 'address@hidden';
 $mail->FromName = 'Mailer';
-$mail->AddAddress('address@hidden', 'Josh Adams');  // Add a recipient
-$mail->AddAddress('address@hidden');               // Name is optional
-$mail->AddReplyTo('address@hidden', 'Information');
-$mail->AddCC('address@hidden');
-$mail->AddBCC('address@hidden');
+$mail->addAddress('address@hidden', 'Josh Adams');  // Add a recipient
+$mail->addAddress('address@hidden');               // Name is optional
+$mail->addReplyTo('address@hidden', 'Information');
+$mail->addCC('address@hidden');
+$mail->addBCC('address@hidden');
 
 $mail->WordWrap = 50;                                 // Set word wrap to 50 
characters
-$mail->AddAttachment('/var/tmp/file.tar.gz');         // Add attachments
-$mail->AddAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
-$mail->IsHTML(true);                                  // Set email format to 
HTML
+$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
+$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
+$mail->isHTML(true);                                  // Set email format to 
HTML
 
 $mail->Subject = 'Here is the subject';
 $mail->Body    = 'This is the HTML message body <b>in bold!</b>';
 $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
 
-if(!$mail->Send()) {
+if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
    exit;
@@ -84,7 +84,7 @@
 
 ```php
 // To load the French version
-$mail->SetLanguage('fr', '/optional/path/to/language/directory/');
+$mail->setLanguage('fr', '/optional/path/to/language/directory/');
 ```
 
 ## Documentation
@@ -107,13 +107,13 @@
 
 With the move to the PHPMailer GitHub organisation, you'll need to update any 
remote URLs referencing the old GitHub location with a command like this from 
within your clone:
 
-git remote set-url upstream https://github.com/PHPMailer/PHPMailer.git
+`git remote set-url upstream https://github.com/PHPMailer/PHPMailer.git`
 
 Please *don't* use the SourceForge or Google Code projects any more.
 
 ## Changelog
 
-See changelog.md
+See [changelog](changelog.md).
 
 ## History
 - PHPMailer was originally written in 2001 by Brent R. Matzelle as a 
[SourceForge project](http://sourceforge.net/projects/phpmailer/).

Modified: branches/Version-1_0-branch/phpgwapi/inc/phpmailer/changelog.md
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/phpmailer/changelog.md     
2013-09-16 13:20:16 UTC (rev 11295)
+++ branches/Version-1_0-branch/phpgwapi/inc/phpmailer/changelog.md     
2013-09-17 06:31:57 UTC (rev 11296)
@@ -1,5 +1,10 @@
 # ChangeLog
 
+* Increase timeout to match RFC2821 section 4.5.3.2 and thus not fail 
greetdelays, fixes #104
+* Add timestamps to default debug output
+* Add connection events and new level 3 to debug output options
+
+## Version 5.2.7 (September 12th 2013)
 * Add Ukranian translation from @Krezalis
 * Support for do_verp
 * Fix bug in CRAM-MD5 AUTH
@@ -14,19 +19,30 @@
 * Update SyntaxHighlighter
 * Major overhaul and cleanup of example code
 * New PHPMailer graphic
-* MsgHTML now uses RFC2392-compliant content ids
-* Add line break normalization function and use it in MsgHTML
+* msgHTML now uses RFC2392-compliant content ids
+* Add line break normalization function and use it in msgHTML
 * Don't set unnecessary reply-to addresses
 * Make fakesendmail.sh a bit cleaner and safer
 * Set a content-transfer-encoding on multiparts (fixes msglint error)
-* Fix cid generation in MsgHTML (Thanks to @digitalthought)
+* Fix cid generation in msgHTML (Thanks to @digitalthought)
 * Fix handling of multiple SMTP servers (Thanks to @NanoCaiordo)
-* SMTP->Connect() now supports stream context options (Thanks to 
@stanislavdavid)
+* SMTP->connect() now supports stream context options (Thanks to 
@stanislavdavid)
 * Add support for iCal event alternatives (Thanks to @reblutus)
 * Update to Polish language file (Thanks to Krzysztof Kowalewski)
 * Update to Norwegian language file (Thanks to @datagutten)
 * Update to Hungarian language file (Thanks to @dominicus-75)
 * Add Persian/Farsi translation from @jaii
+* Make SMTPDebug property type match type in SMTP class
+* Add unit tests for DKIM
+* Major refactor of SMTP class
+* Reformat to PSR-2 coding standard
+* Introduce autoloader
+* Allow overriding of SMTP class
+* Overhaul of PHPDocs
+* Fix broken Q-encoding
+* Czech language update (Thanks to @nemelu)
+* Removal of excess blank lines in messages
+* Added fake POP server and unit tests for POP-before-SMTP
 
 ## Version 5.2.6 (April 11th 2013)
 * Reflect move to PHPMailer GitHub organisation at 
https://github.com/PHPMailer/PHPMailer

Deleted: branches/Version-1_0-branch/phpgwapi/inc/phpmailer/changelog.txt
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/phpmailer/changelog.txt    
2013-09-16 13:20:16 UTC (rev 11295)
+++ branches/Version-1_0-branch/phpgwapi/inc/phpmailer/changelog.txt    
2013-09-17 06:31:57 UTC (rev 11296)
@@ -1,408 +0,0 @@
-ChangeLog
-
-NOTE: THIS VERSION OF PHPMAILER IS DESIGNED FOR PHP5/PHP6.
-      IT WILL NOT WORK WITH PHP4.
-
-Version 5.1 (October 20, 2009)
-* fixed filename issue with AddStringAttachment (thanks to Tony)
-* fixed "SingleTo" property, now works with Senmail, Qmail, and SMTP in
-  addition to PHP mail()
-* added DKIM digital signing functionality
-  New properties:
-  - DKIM_domain (sets the domain name)
-  - DKIM_private (holds DKIM private key)
-  - DKIM_passphrase (holds your DKIM passphrase)
-  - DKIM_selector (holds the DKIM "selector")
-  - DKIM_identity (holds the identifying email address)
-* added callback function support
-  - callback function parameters include:
-    result, to, cc, bcc, subject and body
-  * see the test/test_callback.php file for usage.
-* added "auto" identity functionality
-  - can automatically add:
-    - Return-path (if Sender not set)
-    - Reply-To (if ReplyTo not set)
-  - can be disabled:
-    - $mail->SetFrom('address@hidden','First Last',false);
-    - or by adding the $mail->Sender and/or $mail->ReplyTo properties
-  Note: "auto" identity added to help with emails ending up in spam
-  or junk boxes because of missing headers
-
-Version 5.0.2 (May 24, 2009)
-* Fix for missing attachments when inline graphics are present
-* Fix for missing Cc in header when using SMTP (mail was sent,
-  but not displayed in header -- Cc receiver only saw email To: 
-  line and no Cc line, but did get the email (To receiver
-  saw same)
-
-Version 5.0.1 (April 05, 2009)
-* Temporary fix for missing attachments
-
-Version 5.0.0 (April 02, 2009)
-
-* With the release of this version, we are initiating a new version numbering
-  system to differentiate from the PHP4 version of PHPMailer.
-* Most notable in this release is fully object oriented code.
-class.smtp.php:
-* Refactored class.smtp.php to support new exception handling
-  code size reduced from 29.2 Kb to 25.6 Kb
-* Removed unnecessary functions from class.smtp.php:
-  public function Expand($name) {
-  public function Help($keyword="") {
-  public function Noop() {
-  public function Send($from) {
-  public function SendOrMail($from) {
-  public function Verify($name) {
-class.phpmailer.php:
-* Refactored class.phpmailer.php with new exception handling
-* Changed processing functionality of Sendmail and Qmail so they cannot be
-  inadvertently used
-* removed getFile() function, just became a simple wrapper for
-  file_get_contents()
-* added check for PHP version (will gracefully exit if not at least PHP 5.0)
-class.phpmailer.php enhancements
-* enhanced code to check if an attachment source is the same as an embedded or
-  inline graphic source to eliminate duplicate attachments
-New /test_script
-* We have written a test script you can use to test the script as part of your
-  installation. Once you press submit, the test script will send a multi-mime
-  email with either the message you type in or an HTML email with an inline
-  graphic. Two attachments are included in the email (one of the attachments
-  is also the inline graphic so you can see that only one copy of the graphic
-  is sent in the email). The test script will also display the functional
-  script that you can copy/paste to your editor to duplicate the functionality.
-New examples
-* All new examples in both basic and advanced modes. Advanced examples show
-  Exception handling.
-PHPDocumentator (phpdocs) documentation for PHPMailer version 5.0.0
-* all new documentation
-
-Please note: the website has been updated to reflect the changes in PHPMailer
-version 5.0.0. http://phpmailer.codeworxtech.com/
-
-Version 2.3 (November 06, 2008)
-
-* added Arabic language (many thanks to Bahjat Al Mostafa)
-* removed English language from language files and made it a default within
-  class.phpmailer.php - if no language is found, it will default to use
-  the english language translation
-* fixed public/private declarations
-* corrected line 1728, $basedir to $directory
-* added $sign_cert_file to avoid improper duplicate use of $sign_key_file
-* corrected $this->Hello on line 612 to $this->Helo
-* changed default of $LE to "\r\n" to comply with RFC 2822. Can be set by the 
user
-  if default is not acceptable
-* removed trim() from return results in EncodeQP
-* /test and three files it contained are removed from version 2.3
-* fixed phpunit.php for compliance with PHP5
-* changed $this->AltBody = $textMsg; to $this->AltBody = 
html_entity_decode($textMsg);
-* We have removed the /phpdoc from the downloads. All documentation is now on
-  the http://phpmailer.codeworxtech.com website.
-
-Version 2.2.1 () July 19 2008
-
-* fixed line 1092 in class.smtp.php (my apologies, error on my part)
-
-Version 2.2 () July 15 2008
-
-* Fixed redirect issue (display of UTF-8 in thank you redirect)
-* fixed error in getResponse function declaration (class.pop3.php)
-* PHPMailer now PHP6 compliant
-* fixed line 1092 in class.smtp.php (endless loop from missing = sign)
-
-Version 2.1 (Wed, June 04 2008)
-
-** NOTE: WE HAVE A NEW LANGUAGE VARIABLE FOR DIGITALLY SIGNED S/MIME EMAILS.
-   IF YOU CAN HELP WITH LANGUAGES OTHER THAN ENGLISH AND SPANISH, IT WOULD BE
-   APPRECIATED.
-
-* added S/MIME functionality (ability to digitally sign emails)
-  BIG THANKS TO "sergiocambra" for posting this patch back in November 2007.
-  The "Signed Emails" functionality adds the Sign method to pass the private 
key
-  filename and the password to read it, and then email will be sent with
-  content-type multipart/signed and with the digital signature attached.
-* fully compatible with E_STRICT error level
-  - Please note:
-    In about half the test environments this development version was subjected
-    to, an error was thrown for the date() functions used (line 1565 and 1569).
-    This is NOT a PHPMailer error, it is the result of an incorrectly 
configured
-    PHP5 installation. The fix is to modify your 'php.ini' file and include the
-    date.timezone = America/New York
-    directive, to your own server timezone
-  - If you do get this error, and are unable to access your php.ini file:
-    In your PHP script, add
-    date_default_timezone_set('America/Toronto');
-    - do not try to use
-    $myVar = date_default_timezone_get();
-    as a test, it will throw an error.
-* added ability to define path (mainly for embedded images)
-  function MsgHTML($message,$basedir='') ... where:
-  $basedir is the fully qualified path
-* fixed MsgHTML() function:
-  - Embedded Images where images are specified by <protocol>:// will not be 
altered or embedded
-* fixed the return value of SMTP exit code ( pclose )
-* addressed issue of multibyte characters in subject line and truncating
-* added ability to have user specified Message ID
-  (default is still that PHPMailer create a unique Message ID)
-* corrected unidentified message type to 'application/octet-stream'
-* fixed chunk_split() multibyte issue (thanks to Colin Brown, et al).
-* added check for added attachments
-* enhanced conversion of HTML to text in MsgHTML (thanks to "brunny")
-
-Version 2.1.0beta2 (Sun, Dec 02 2007)
-* implemented updated EncodeQP (thanks to coolbru, aka Marcus Bointon)
-* finished all testing, all known bugs corrected, enhancements tested
-- note: will NOT work with PHP4.
-
-please note, this is BETA software
-** DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS
-INTENDED STRICTLY FOR TESTING
-
-Version 2.1.0beta1
-please note, this is BETA software
-** DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS
-INTENDED STRICTLY FOR TESTING
-
-Version 2.0.0 rc2 (Fri, Nov 16 2007), interim release
-* implements new property to control VERP in class.smtp.php
-  example (requires instantiating class.smtp.php):
-  $mail->do_verp = true;
-* POP-before-SMTP functionality included, thanks to Richard Davey
-  (see class.pop3.php & pop3_before_smtp_test.php for examples)
-* included example showing how to use PHPMailer with GMAIL
-* fixed the missing Cc in SendMail() and Mail()
-
-******************
-A note on sending bulk emails:
-
-If the email you are sending is not personalized, consider using the
-"undisclosed-recipient:;" strategy. That is, put all of your recipients
-in the Bcc field and set the To field to "undisclosed-recipients:;".
-It's a lot faster (only one send) and saves quite a bit on resources.
-Contrary to some opinions, this will not get you listed in spam engines -
-it's a legitimate way for you to send emails.
-
-A partial example for use with PHPMailer:
-
-$mail->AddAddress("undisclosed-recipients:;");
-$mail->AddBCC("address@hidden,address@hidden,address@hidden");
-
-Many email service providers restrict the number of emails that can be sent
-in any given time period. Often that is between 50 - 60 emails maximum
-per hour or per send session.
-
-If that's the case, then break up your Bcc lists into chunks that are one
-less than your limit, and put a pause in your script.
-*******************
-
-Version 2.0.0 rc1 (Thu, Nov 08 2007), interim release
-* dramatically simplified using inline graphics ... it's fully automated and 
requires no user input
-* added automatic document type detection for attachments and pictures
-* added MsgHTML() function to replace Body tag for HTML emails
-* fixed the SendMail security issues (input validation vulnerability)
-* enhanced the AddAddresses functionality so that the "Name" portion is used 
in the email address
-* removed the need to use the AltBody method (set from the HTML, or default 
text used)
-* set the PHP Mail() function as the default (still support SendMail, SMTP 
Mail)
-* removed the need to set the IsHTML property (set automatically)
-* added Estonian language file by Indrek P&auml;ri
-* added header injection patch
-* added "set" method to permit users to create their own pseudo-properties 
like 'X-Headers', etc.
-  example of use:
-  $mail->set('X-Priority', '3');
-  $mail->set('X-MSMail-Priority', 'Normal');
-* fixed warning message in SMTP get_lines method
-* added TLS/SSL SMTP support
-  example of use:
-  $mail = new PHPMailer();
-  $mail->Mailer = "smtp";
-  $mail->Host = "smtp.example.com";
-  $mail->SMTPSecure   = "tls"; // option
-  //$mail->SMTPSecure   = "ssl";  // option
-  ...
-  $mail->Send();
-* PHPMailer has been tested with PHP4 (4.4.7) and PHP5 (5.2.7)
-* Works with PHP installed as a module or as CGI-PHP
-- NOTE: will NOT work with PHP5 in E_STRICT error mode
-
-Version 1.73 (Sun, Jun 10 2005)
-* Fixed denial of service bug: http://www.cybsec.com/vuln/PHPMailer-DOS.pdf
-* Now has a total of 20 translations
-* Fixed alt attachments bug: http://tinyurl.com/98u9k
-
-Version 1.72 (Wed, May 25 2004)
-* Added Dutch, Swedish, Czech, Norwegian, and Turkish translations.
-* Received: Removed this method because spam filter programs like
-SpamAssassin reject this header.
-* Fixed error count bug.
-* SetLanguage default is now "language/".
-* Fixed magic_quotes_runtime bug.
-
-Version 1.71 (Tue, Jul 28 2003)
-* Made several speed enhancements
-* Added German and Italian translation files
-* Fixed HELO/AUTH bugs on keep-alive connects
-* Now provides an error message if language file does not load
-* Fixed attachment EOL bug
-* Updated some unclear documentation
-* Added additional tests and improved others
-
-Version 1.70 (Mon, Jun 20 2003)
-* Added SMTP keep-alive support
-* Added IsError method for error detection
-* Added error message translation support (SetLanguage)
-* Refactored many methods to increase library performance
-* Hello now sends the newer EHLO message before HELO as per RFC 2821
-* Removed the boundary class and replaced it with GetBoundary
-* Removed queue support methods
-* New $Hostname variable
-* New Message-ID header
-* Received header reformat
-* Helo variable default changed to $Hostname
-* Removed extra spaces in Content-Type definition (#667182)
-* Return-Path should be set to Sender when set
-* Adds Q or B encoding to headers when necessary
-* quoted-encoding should now encode NULs \000
-* Fixed encoding of body/AltBody (#553370)
-* Adds "To: undisclosed-recipients:;" when all recipients are hidden (BCC)
-* Multiple bug fixes
-
-Version 1.65 (Fri, Aug 09 2002)
-* Fixed non-visible attachment bug (#585097) for Outlook
-* SMTP connections are now closed after each transaction
-* Fixed SMTP::Expand return value
-* Converted SMTP class documentation to phpDocumentor format
-
-Version 1.62 (Wed, Jun 26 2002)
-* Fixed multi-attach bug
-* Set proper word wrapping
-* Reduced memory use with attachments
-* Added more debugging
-* Changed documentation to phpDocumentor format
-
-Version 1.60 (Sat, Mar 30 2002)
-* Sendmail pipe and address patch (Christian Holtje)
-* Added embedded image and read confirmation support (A. Ognio)
-* Added unit tests
-* Added SMTP timeout support (*nix only)
-* Added possibly temporary PluginDir variable for SMTP class
-* Added LE message line ending variable
-* Refactored boundary and attachment code
-* Eliminated SMTP class warnings
-* Added SendToQueue method for future queuing support
-
-Version 1.54 (Wed, Dec 19 2001)
-* Add some queuing support code
-* Fixed a pesky multi/alt bug
-* Messages are no longer forced to have "To" addresses
-
-Version 1.50 (Thu, Nov 08 2001)
-* Fix extra lines when not using SMTP mailer
-* Set WordWrap variable to int with a zero default
-
-Version 1.47 (Tue, Oct 16 2001)
-* Fixed Received header code format
-* Fixed AltBody order error
-* Fixed alternate port warning
-
-Version 1.45 (Tue, Sep 25 2001)
-* Added enhanced SMTP debug support
-* Added support for multiple ports on SMTP
-* Added Received header for tracing
-* Fixed AddStringAttachment encoding
-* Fixed possible header name quote bug
-* Fixed wordwrap() trim bug
-* Couple other small bug fixes
-
-Version 1.41 (Wed, Aug 22 2001)
-* Fixed AltBody bug w/o attachments
-* Fixed rfc_date() for certain mail servers
-
-Version 1.40 (Sun, Aug 12 2001)
-* Added multipart/alternative support (AltBody)
-* Documentation update
-* Fixed bug in Mercury MTA
-
-Version 1.29 (Fri, Aug 03 2001)
-* Added AddStringAttachment() method
-* Added SMTP authentication support
-
-Version 1.28 (Mon, Jul 30 2001)
-* Fixed a typo in SMTP class
-* Fixed header issue with Imail (win32) SMTP server
-* Made fopen() calls for attachments use "rb" to fix win32 error
-
-Version 1.25 (Mon, Jul 02 2001)
-* Added RFC 822 date fix (Patrice)
-* Added improved error handling by adding a $ErrorInfo variable
-* Removed MailerDebug variable (obsolete with new error handler)
-
-Version 1.20 (Mon, Jun 25 2001)
-* Added quoted-printable encoding (Patrice)
-* Set Version as public and removed PrintVersion()
-* Changed phpdoc to only display public variables and methods
-
-Version 1.19 (Thu, Jun 21 2001)
-* Fixed MS Mail header bug
-* Added fix for Bcc problem with mail(). *Does not work on Win32*
-  (See PHP bug report: http://www.php.net/bugs.php?id=11616)
-* mail() no longer passes a fifth parameter when not needed
-
-Version 1.15 (Fri, Jun 15 2001)
-[Note: these changes contributed by Patrice Fournier]
-* Changed all remaining \n to \r\n
-* Bcc: header no longer writen to message except
-when sent directly to sendmail
-* Added a small message to non-MIME compliant mail reader
-* Added Sender variable to change the Sender email
-used in -f for sendmail/mail and in 'MAIL FROM' for smtp mode
-* Changed boundary setting to a place it will be set only once
-* Removed transfer encoding for whole message when using multipart
-* Message body now uses Encoding in multipart messages
-* Can set encoding and type to attachments 7bit, 8bit
-and binary attachment are sent as is, base64 are encoded
-* Can set Encoding to base64 to send 8 bits body
-through 7 bits servers
-
-Version 1.10 (Tue, Jun 12 2001)
-* Fixed win32 mail header bug (printed out headers in message body)
-
-Version 1.09 (Fri, Jun 08 2001)
-* Changed date header to work with Netscape mail programs
-* Altered phpdoc documentation
-
-Version 1.08 (Tue, Jun 05 2001)
-* Added enhanced error-checking
-* Added phpdoc documentation to source
-
-Version 1.06 (Fri, Jun 01 2001)
-* Added optional name for file attachments
-
-Version 1.05 (Tue, May 29 2001)
-* Code cleanup
-* Eliminated sendmail header warning message
-* Fixed possible SMTP error
-
-Version 1.03 (Thu, May 24 2001)
-* Fixed problem where qmail sends out duplicate messages
-
-Version 1.02 (Wed, May 23 2001)
-* Added multiple recipient and attachment Clear* methods
-* Added Sendmail public variable
-* Fixed problem with loading SMTP library multiple times
-
-Version 0.98 (Tue, May 22 2001)
-* Fixed problem with redundant mail hosts sending out multiple messages
-* Added additional error handler code
-* Added AddCustomHeader() function
-* Added support for Microsoft mail client headers (affects priority)
-* Fixed small bug with Mailer variable
-* Added PrintVersion() function
-
-Version 0.92 (Tue, May 15 2001)
-* Changed file names to class.phpmailer.php and class.smtp.php to match
-  current PHP class trend.
-* Fixed problem where body not being printed when a message is attached
-* Several small bug fixes
-
-Version 0.90 (Tue, April 17 2001)
-* Intial public release

Modified: branches/Version-1_0-branch/phpgwapi/inc/phpmailer/class.phpmailer.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/phpmailer/class.phpmailer.php      
2013-09-16 13:20:16 UTC (rev 11295)
+++ branches/Version-1_0-branch/phpgwapi/inc/phpmailer/class.phpmailer.php      
2013-09-17 06:31:57 UTC (rev 11296)
@@ -1,2959 +1,3268 @@
 <?php
-/*~ class.phpmailer.php
-.---------------------------------------------------------------------------.
-|  Software: PHPMailer - PHP email class                                    |
-|   Version: 5.2.6                                                          |
-|      Site: https://github.com/PHPMailer/PHPMailer/                        |
-| ------------------------------------------------------------------------- |
-|    Admins: Marcus Bointon                                                 |
-|    Admins: Jim Jagielski                                                  |
-|   Authors: Andy Prevost (codeworxtech) address@hidden |
-|          : Marcus Bointon (coolbru) address@hidden          |
-|          : Jim Jagielski (jimjag) address@hidden                        |
-|   Founder: Brent R. Matzelle (original founder)                           |
-| Copyright (c) 2010-2012, Jim Jagielski. All Rights Reserved.              |
-| Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved.               |
-| Copyright (c) 2001-2003, Brent R. Matzelle                                |
-| ------------------------------------------------------------------------- |
-|   License: Distributed under the Lesser General Public License (LGPL)     |
-|            http://www.gnu.org/copyleft/lesser.html                        |
-| This program is distributed in the hope that it will be useful - WITHOUT  |
-| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     |
-| FITNESS FOR A PARTICULAR PURPOSE.                                         |
-'---------------------------------------------------------------------------'
-*/
-
 /**
- * PHPMailer - PHP email creation and transport class
- * NOTE: Requires PHP version 5 or later
+ * PHPMailer - PHP email creation and transport class.
+ * PHP Version 5.0.0
+ * Version 5.2.7
  * @package PHPMailer
- * @author Andy Prevost
- * @author Marcus Bointon
- * @author Jim Jagielski
+ * @link https://github.com/PHPMailer/PHPMailer/
+ * @author Marcus Bointon (coolbru) <address@hidden>
+ * @author Jim Jagielski (jimjag) <address@hidden>
+ * @author Andy Prevost (codeworxtech) <address@hidden>
+ * @author Brent R. Matzelle (original founder)
+ * @copyright 2013 Marcus Bointon
  * @copyright 2010 - 2012 Jim Jagielski
  * @copyright 2004 - 2009 Andy Prevost
  * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public 
License
+ * @note This program is distributed in the hope that it will be useful - 
WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-if (version_compare(PHP_VERSION, '5.0.0', '<') ) {
-  exit("Sorry, PHPMailer will only run on PHP version 5 or greater!\n");
+if (version_compare(PHP_VERSION, '5.0.0', '<')) {
+    exit("Sorry, PHPMailer will only run on PHP version 5 or greater!\n");
 }
 
 /**
- * PHP email creation and transport class
+ * PHPMailer - PHP email creation and transport class.
+ * PHP Version 5.0.0
  * @package PHPMailer
+ * @author Marcus Bointon (coolbru) <address@hidden>
+ * @author Jim Jagielski (jimjag) <address@hidden>
+ * @author Andy Prevost (codeworxtech) <address@hidden>
+ * @author Brent R. Matzelle (original founder)
+ * @copyright 2013 Marcus Bointon
+ * @copyright 2010 - 2012 Jim Jagielski
+ * @copyright 2004 - 2009 Andy Prevost
  */
-class PHPMailer {
+class PHPMailer
+{
+    /**
+     * The PHPMailer Version number.
+     * @type string
+     */
+    public $Version = '5.2.7';
 
-  /////////////////////////////////////////////////
-  // PROPERTIES, PUBLIC
-  /////////////////////////////////////////////////
+    /**
+     * Email priority.
+     * Options: 1 = High, 3 = Normal, 5 = low.
+     * @type int
+     */
+    public $Priority = 3;
 
-  /**
-   * Email priority (1 = High, 3 = Normal, 5 = low).
-   * @var int
-   */
-  public $Priority          = 3;
+    /**
+     * The character set of the message.
+     * @type string
+     */
+    public $CharSet = 'iso-8859-1';
 
-  /**
-   * Sets the CharSet of the message.
-   * @var string
-   */
-  public $CharSet           = 'iso-8859-1';
+    /**
+     * The MIME Content-type of the message.
+     * @type string
+     */
+    public $ContentType = 'text/plain';
 
-  /**
-   * Sets the Content-type of the message.
-   * @var string
-   */
-  public $ContentType       = 'text/plain';
+    /**
+     * The message encoding.
+     * Options: "8bit", "7bit", "binary", "base64", and "quoted-printable".
+     * @type string
+     */
+    public $Encoding = '8bit';
 
-  /**
-   * Sets the Encoding of the message. Options for this are
-   *  "8bit", "7bit", "binary", "base64", and "quoted-printable".
-   * @var string
-   */
-  public $Encoding          = '8bit';
+    /**
+     * Holds the most recent mailer error message.
+     * @type string
+     */
+    public $ErrorInfo = '';
 
-  /**
-   * Holds the most recent mailer error message.
-   * @var string
-   */
-  public $ErrorInfo         = '';
+    /**
+     * The From email address for the message.
+     * @type string
+     */
+    public $From = 'address@hidden';
 
-  /**
-   * Sets the From email address for the message.
-   * @var string
-   */
-  public $From              = 'address@hidden';
+    /**
+     * The From name of the message.
+     * @type string
+     */
+    public $FromName = 'Root User';
 
-  /**
-   * Sets the From name of the message.
-   * @var string
-   */
-  public $FromName          = 'Root User';
+    /**
+     * The Sender email (Return-Path) of the message.
+     * If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp 
mode.
+     * @type string
+     */
+    public $Sender = '';
 
-  /**
-   * Sets the Sender email (Return-Path) of the message.
-   * If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp 
mode.
-   * @var string
-   */
-  public $Sender            = '';
+    /**
+     * The Return-Path of the message.
+     * If empty, it will be set to either From or Sender.
+     * @type string
+     */
+    public $ReturnPath = '';
 
-  /**
-   * Sets the Return-Path of the message.  If empty, it will
-   * be set to either From or Sender.
-   * @var string
-   */
-  public $ReturnPath        = '';
+    /**
+     * The Subject of the message.
+     * @type string
+     */
+    public $Subject = '';
 
-  /**
-   * Sets the Subject of the message.
-   * @var string
-   */
-  public $Subject           = '';
+    /**
+     * An HTML or plain text message body.
+     * If HTML then call isHTML(true).
+     * @type string
+     */
+    public $Body = '';
 
-  /**
-   * An HTML or plain text message body.
-   * If HTML then call IsHTML(true).
-   * @var string
-   */
-  public $Body              = '';
+    /**
+     * The plain-text message body.
+     * This body can be read by mail clients that do not have HTML email
+     * capability such as mutt & Eudora.
+     * Clients that can read HTML will view the normal Body.
+     * @type string
+     */
+    public $AltBody = '';
 
-  /**
-   * The plain-text message body.
-   * This body can be read by mail clients that do not have HTML email
-   * capability such as mutt & Eudora.
-   * Clients that can read HTML will view the normal Body.
-   * @var string
-   */
-  public $AltBody           = '';
+    /**
+     * An iCal message part body.
+     * Only supported in simple alt or alt_inline message types
+     * To generate iCal events, use the bundled extras/EasyPeasyICS.php class 
or iCalcreator
+     * @link 
http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/
+     * @link http://kigkonsult.se/iCalcreator/
+     * @type string
+     */
+    public $Ical = '';
 
-  /**
-   * An iCal message part body
-   * Only supported in simple alt or alt_inline message types
-   * To generate iCal events, use the bundled extras/EasyPeasyICS.php class or 
iCalcreator
-   * @link 
http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/
-   * @link http://kigkonsult.se/iCalcreator/
-   * @var string
-   */
-  public $Ical              = '';
+    /**
+     * The complete compiled MIME message body.
+     * @access protected
+     * @type string
+     */
+    protected $MIMEBody = '';
 
-  /**
-   * Stores the complete compiled MIME message body.
-   * @var string
-   * @access protected
-   */
-  protected $MIMEBody       = '';
+    /**
+     * The complete compiled MIME message headers.
+     * @type string
+     * @access protected
+     */
+    protected $MIMEHeader = '';
 
-  /**
-   * Stores the complete compiled MIME message headers.
-   * @var string
-   * @access protected
-   */
-  protected $MIMEHeader     = '';
+    /**
+     * Extra headers that createHeader() doesn't fold in.
+     * @type string
+     * @access protected
+     */
+    protected $mailHeader = '';
 
-  /**
-   * Stores the extra header list which CreateHeader() doesn't fold in
-   * @var string
-   * @access protected
-   */
-  protected $mailHeader     = '';
+    /**
+     * Word-wrap the message body to this number of chars.
+     * @type int
+     */
+    public $WordWrap = 0;
 
-  /**
-   * Sets word wrapping on the body of the message to a given number of
-   * characters.
-   * @var int
-   */
-  public $WordWrap          = 0;
+    /**
+     * Which method to use to send mail.
+     * Options: "mail", "sendmail", or "smtp".
+     * @type string
+     */
+    public $Mailer = 'mail';
 
-  /**
-   * Method to send mail: ("mail", "sendmail", or "smtp").
-   * @var string
-   */
-  public $Mailer            = 'mail';
+    /**
+     * The path to the sendmail program.
+     * @type string
+     */
+    public $Sendmail = '/usr/sbin/sendmail';
 
-  /**
-   * Sets the path of the sendmail program.
-   * @var string
-   */
-  public $Sendmail          = '/usr/sbin/sendmail';
+    /**
+     * Whether mail() uses a fully sendmail-compatible MTA.
+     * One which supports sendmail's "-oi -f" options.
+     * @type bool
+     */
+    public $UseSendmailOptions = true;
 
-  /**
-   * Determine if mail() uses a fully sendmail compatible MTA that
-   * supports sendmail's "-oi -f" options
-   * @var boolean
-   */
-  public $UseSendmailOptions   = true;
+    /**
+     * Path to PHPMailer plugins.
+     * Useful if the SMTP class is not in the PHP include path.
+     * @type string
+     * @deprecated Should not be needed now there is an autoloader.
+     */
+    public $PluginDir = '';
 
-  /**
-   * Path to PHPMailer plugins.  Useful if the SMTP class
-   * is in a different directory than the PHP include path.
-   * @var string
-   */
-  public $PluginDir         = '';
+    /**
+     * The email address that a reading confirmation should be sent to.
+     * @type string
+     */
+    public $ConfirmReadingTo = '';
 
-  /**
-   * Sets the email address that a reading confirmation will be sent.
-   * @var string
-   */
-  public $ConfirmReadingTo  = '';
+    /**
+     * The hostname to use in Message-Id and Received headers
+     * and as default HELO string.
+     * If empty, the value returned
+     * by SERVER_NAME is used or 'localhost.localdomain'.
+     * @type string
+     */
+    public $Hostname = '';
 
-  /**
-   * Sets the hostname to use in Message-Id and Received headers
-   * and as default HELO string. If empty, the value returned
-   * by SERVER_NAME is used or 'localhost.localdomain'.
-   * @var string
-   */
-  public $Hostname          = '';
+    /**
+     * An ID to be used in the Message-Id header.
+     * If empty, a unique id will be generated.
+     * @type string
+     */
+    public $MessageID = '';
 
-  /**
-   * Sets the message ID to be used in the Message-Id header.
-   * If empty, a unique id will be generated.
-   * @var string
-   */
-  public $MessageID         = '';
+    /**
+     * The message Date to be used in the Date header.
+     * If empty, the current date will be added.
+     * @type string
+     */
+    public $MessageDate = '';
 
-  /**
-   * Sets the message Date to be used in the Date header.
-   * If empty, the current date will be added.
-   * @var string
-   */
-  public $MessageDate       = '';
+    /**
+     * SMTP hosts.
+     * Either a single hostname or multiple semicolon-delimited hostnames.
+     * You can also specify a different port
+     * for each host by using this format: [hostname:port]
+     * (e.g. "smtp1.example.com:25;smtp2.example.com").
+     * Hosts will be tried in order.
+     * @type string
+     */
+    public $Host = 'localhost';
 
-  /////////////////////////////////////////////////
-  // PROPERTIES FOR SMTP
-  /////////////////////////////////////////////////
+    /**
+     * The default SMTP server port.
+     * @type int
+     * @Todo Why is this needed when the SMTP class takes care of it?
+     */
+    public $Port = 25;
 
-  /**
-   * Sets the SMTP hosts.
-   *
-   * All hosts must be separated by a
-   * semicolon.  You can also specify a different port
-   * for each host by using this format: [hostname:port]
-   * (e.g. "smtp1.example.com:25;smtp2.example.com").
-   * Hosts will be tried in order.
-   * @var string
-   */
-  public $Host          = 'localhost';
+    /**
+     * The SMTP HELO of the message.
+     * Default is $Hostname.
+     * @type string
+     * @see PHPMailer::$Hostname
+     */
+    public $Helo = '';
 
-  /**
-   * Sets the default SMTP server port.
-   * @var int
-   */
-  public $Port          = 25;
+    /**
+     * The secure connection prefix.
+     * Options: "", "ssl" or "tls"
+     * @type string
+     */
+    public $SMTPSecure = '';
 
-  /**
-   * Sets the SMTP HELO of the message (Default is $Hostname).
-   * @var string
-   */
-  public $Helo          = '';
+    /**
+     * Whether to use SMTP authentication.
+     * Uses the Username and Password properties.
+     * @type bool
+     * @see PHPMailer::$Username
+     * @see PHPMailer::$Password
+     */
+    public $SMTPAuth = false;
 
-  /**
-   * Sets connection prefix. Options are "", "ssl" or "tls"
-   * @var string
-   */
-  public $SMTPSecure    = '';
+    /**
+     * SMTP username.
+     * @type string
+     */
+    public $Username = '';
 
-  /**
-   * Sets SMTP authentication. Utilizes the Username and Password variables.
-   * @var bool
-   */
-  public $SMTPAuth      = false;
+    /**
+     * SMTP password.
+     * @type string
+     */
+    public $Password = '';
 
-  /**
-   * Sets SMTP username.
-   * @var string
-   */
-  public $Username      = '';
+    /**
+     * SMTP auth type.
+     * Options are LOGIN (default), PLAIN, NTLM, CRAM-MD5
+     * @type string
+     */
+    public $AuthType = '';
 
-  /**
-   * Sets SMTP password.
-   * @var string
-   */
-  public $Password      = '';
+    /**
+     * SMTP realm.
+     * Used for NTLM auth
+     * @type string
+     */
+    public $Realm = '';
 
-  /**
-   *  Sets SMTP auth type. Options are LOGIN | PLAIN | NTLM | CRAM-MD5 
(default LOGIN)
-   *  @var string
-   */
-  public $AuthType      = '';
+    /**
+     * SMTP workstation.
+     * Used for NTLM auth
+     * @type string
+     */
+    public $Workstation = '';
 
-  /**
-   *  Sets SMTP realm.
-   *  @var string
-   */
-  public $Realm         = '';
+    /**
+     * The SMTP server timeout in seconds.
+     * @type int
+     */
+    public $Timeout = 10;
 
-  /**
-   *  Sets SMTP workstation.
-   *  @var string
-   */
-  public $Workstation   = '';
+    /**
+     * SMTP class debug output mode.
+     * Options: 0 = off, 1 = commands, 2 = commands and data
+     * @type int
+     * @see SMTP::$do_debug
+     */
+    public $SMTPDebug = 0;
 
-  /**
-   * Sets the SMTP server timeout in seconds.
-   * This function will not work with the win32 version.
-   * @var int
-   */
-  public $Timeout       = 10;
+    /**
+     * The function/method to use for debugging output.
+     * Options: "echo" or "error_log"
+     * @type string
+     * @see SMTP::$Debugoutput
+     */
+    public $Debugoutput = "echo";
 
-  /**
-   * Sets SMTP class debugging on or off.
-   * @var bool
-   */
-  public $SMTPDebug     = false;
+    /**
+     * Whether to keep SMTP connection open after each message.
+     * If this is set to true then to close the connection
+     * requires an explicit call to smtpClose().
+     * @type bool
+     */
+    public $SMTPKeepAlive = false;
 
-  /**
-   * Sets the function/method to use for debugging output.
-   * Right now we only honor "echo" or "error_log"
-   * @var string
-   */
-  public $Debugoutput     = "echo";
+    /**
+     * Whether to split multiple to addresses into multiple messages
+     * or send them all in one message.
+     * @type bool
+     */
+    public $SingleTo = false;
 
-  /**
-   * Prevents the SMTP connection from being closed after each mail
-   * sending.  If this is set to true then to close the connection
-   * requires an explicit call to SmtpClose().
-   * @var bool
-   */
-  public $SMTPKeepAlive = false;
+    /**
+     * Storage for addresses when SingleTo is enabled.
+     * @type array
+     * @todo This should really not be public
+     */
+    public $SingleToArray = array();
 
-  /**
-   * Provides the ability to have the TO field process individual
-   * emails, instead of sending to entire TO addresses
-   * @var bool
-   */
-  public $SingleTo      = false;
+    /**
+     * Whether to generate VERP addresses on send.
+     * Only applicable when sending via SMTP.
+     * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
+     * @type bool
+     */
+    public $do_verp = false;
 
-  /**
-   * Should we generate VERP addresses when sending via SMTP?
-   * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
-   * @var bool
-   */
-  public $do_verp      = false;
+    /**
+     * Whether to allow sending messages with an empty body.
+     * @type bool
+     */
+    public $AllowEmpty = false;
 
-  /**
-   * If SingleTo is true, this provides the array to hold the email addresses
-   * @var bool
-   */
-  public $SingleToArray = array();
+    /**
+     * The default line ending.
+     * @note The default remains "\n". We force CRLF where we know
+     *        it must be used via self::CRLF.
+     * @type string
+     */
+    public $LE = "\n";
 
-  /**
-   * Should we allow sending messages with empty body?
-   * @var bool
-   */
-  public $AllowEmpty = false;
+    /**
+     * DKIM selector.
+     * @type string
+     */
+    public $DKIM_selector = '';
 
     /**
-   * Provides the ability to change the generic line ending
-   * NOTE: The default remains '\n'. We force CRLF where we KNOW
-   *        it must be used via self::CRLF
-   * @var string
-   */
-  public $LE              = "\n";
+     * DKIM Identity.
+     * Usually the email address used as the source of the email
+     * @type string
+     */
+    public $DKIM_identity = '';
 
-   /**
-   * Used with DKIM Signing
-   * required parameter if DKIM is enabled
-   *
-   * domain selector example domainkey
-   * @var string
-   */
-  public $DKIM_selector   = '';
+    /**
+     * DKIM passphrase.
+     * Used if your key is encrypted.
+     * @type string
+     */
+    public $DKIM_passphrase = '';
 
-  /**
-   * Used with DKIM Signing
-   * required if DKIM is enabled, in format of email address 'address@hidden' 
typically used as the source of the email
-   * @var string
-   */
-  public $DKIM_identity   = '';
+    /**
+     * DKIM signing domain name.
+     * @example 'example.com'
+     * @type string
+     */
+    public $DKIM_domain = '';
 
-  /**
-   * Used with DKIM Signing
-   * optional parameter if your private key requires a passphras
-   * @var string
-   */
-  public $DKIM_passphrase   = '';
+    /**
+     * DKIM private key file path.
+     * @type string
+     */
+    public $DKIM_private = '';
 
-  /**
-   * Used with DKIM Singing
-   * required if DKIM is enabled, in format of email address 'domain.com'
-   * @var string
-   */
-  public $DKIM_domain     = '';
+    /**
+     * Callback Action function name.
+     *
+     * The function that handles the result of the send email action.
+     * It is called out by send() for each email sent.
+     *
+     * Value can be:
+     * - 'function_name' for function names
+     * - 'Class::Method' for static method calls
+     * - array($object, 'Method') for calling methods on $object
+     * See http://php.net/is_callable manual page for more details.
+     *
+     * Parameters:
+     *   bool    $result        result of the send action
+     *   string  $to            email address of the recipient
+     *   string  $cc            cc email addresses
+     *   string  $bcc           bcc email addresses
+     *   string  $subject       the subject
+     *   string  $body          the email body
+     *   string  $from          email address of sender
+     * 
+     * @type string
+     */
+    public $action_function = '';
 
-  /**
-   * Used with DKIM Signing
-   * required if DKIM is enabled, path to private key file
-   * @var string
-   */
-  public $DKIM_private    = '';
+    /**
+     * What to use in the X-Mailer header.
+     * Options: null for default, whitespace for none, or a string to use
+     * @type string
+     */
+    public $XMailer = '';
 
-  /**
-   * Callback Action function name.
-   * The function that handles the result of the send email action.
-   * It is called out by Send() for each email sent.
-   *
-   * Value can be:
-   * - 'function_name' for function names
-   * - 'Class::Method' for static method calls
-   * - array($object, 'Method') for calling methods on $object
-   * See http://php.net/is_callable manual page for more details.
-   *
-   * Parameters:
-   *   bool    $result        result of the send action
-   *   string  $to            email address of the recipient
-   *   string  $cc            cc email addresses
-   *   string  $bcc           bcc email addresses
-   *   string  $subject       the subject
-   *   string  $body          the email body
-   *   string  $from          email address of sender
-   * @var string
-   */
-  public $action_function = ''; //'callbackAction';
+    /**
+     * An instance of the SMTP sender class.
+     * @type SMTP
+     * @access protected
+     */
+    protected $smtp = null;
 
-  /**
-   * Sets the PHPMailer Version number
-   * @var string
-   */
-  public $Version         = '5.2.6';
+    /**
+     * The array of 'to' addresses.
+     * @type array
+     * @access protected
+     */
+    protected $to = array();
 
-  /**
-   * What to use in the X-Mailer header
-   * @var string NULL for default, whitespace for None, or actual string to use
-   */
-  public $XMailer         = '';
+    /**
+     * The array of 'cc' addresses.
+     * @type array
+     * @access protected
+     */
+    protected $cc = array();
 
-  /////////////////////////////////////////////////
-  // PROPERTIES, PRIVATE AND PROTECTED
-  /////////////////////////////////////////////////
+    /**
+     * The array of 'bcc' addresses.
+     * @type array
+     * @access protected
+     */
+    protected $bcc = array();
 
-  /**
-   * @var SMTP An instance of the SMTP sender class
-   * @access protected
-   */
-  protected   $smtp           = null;
-  /**
-   * @var array An array of 'to' addresses
-   * @access protected
-   */
-  protected   $to             = array();
-  /**
-   * @var array An array of 'cc' addresses
-   * @access protected
-   */
-  protected   $cc             = array();
-  /**
-   * @var array An array of 'bcc' addresses
-   * @access protected
-   */
-  protected   $bcc            = array();
-  /**
-   * @var array An array of reply-to name and address
-   * @access protected
-   */
-  protected   $ReplyTo        = array();
-  /**
-   * @var array An array of all kinds of addresses: to, cc, bcc, replyto
-   * @access protected
-   */
-  protected   $all_recipients = array();
-  /**
-   * @var array An array of attachments
-   * @access protected
-   */
-  protected   $attachment     = array();
-  /**
-   * @var array An array of custom headers
-   * @access protected
-   */
-  protected   $CustomHeader   = array();
-  /**
-   * @var string The message's MIME type
-   * @access protected
-   */
-  protected   $message_type   = '';
-  /**
-   * @var array An array of MIME boundary strings
-   * @access protected
-   */
-  protected   $boundary       = array();
-  /**
-   * @var array An array of available languages
-   * @access protected
-   */
-  protected   $language       = array();
-  /**
-   * @var integer The number of errors encountered
-   * @access protected
-   */
-  protected   $error_count    = 0;
-  /**
-   * @var string The filename of a DKIM certificate file
-   * @access protected
-   */
-  protected   $sign_cert_file = '';
-  /**
-   * @var string The filename of a DKIM key file
-   * @access protected
-   */
-  protected   $sign_key_file  = '';
-  /**
-   * @var string The password of a DKIM key
-   * @access protected
-   */
-  protected   $sign_key_pass  = '';
-  /**
-   * @var boolean Whether to throw exceptions for errors
-   * @access protected
-   */
-  protected   $exceptions     = false;
+    /**
+     * The array of reply-to names and addresses.
+     * @type array
+     * @access protected
+     */
+    protected $ReplyTo = array();
 
-  /////////////////////////////////////////////////
-  // CONSTANTS
-  /////////////////////////////////////////////////
+    /**
+     * An array of all kinds of addresses.
+     * Includes all of $to, $cc, $bcc, $replyto
+     * @type array
+     * @access protected
+     */
+    protected $all_recipients = array();
 
-  const STOP_MESSAGE  = 0; // message only, continue processing
-  const STOP_CONTINUE = 1; // message?, likely ok to continue processing
-  const STOP_CRITICAL = 2; // message, plus full stop, critical error reached
-  const CRLF = "\r\n";     // SMTP RFC specified EOL
+    /**
+     * The array of attachments.
+     * @type array
+     * @access protected
+     */
+    protected $attachment = array();
 
-  /////////////////////////////////////////////////
-  // METHODS, VARIABLES
-  /////////////////////////////////////////////////
+    /**
+     * The array of custom headers.
+     * @type array
+     * @access protected
+     */
+    protected $CustomHeader = array();
 
-  /**
-   * Calls actual mail() function, but in a safe_mode aware fashion
-   * Also, unless sendmail_path points to sendmail (or something that
-   * claims to be sendmail), don't pass params (not a perfect fix,
-   * but it will do)
-   * @param string $to To
-   * @param string $subject Subject
-   * @param string $body Message Body
-   * @param string $header Additional Header(s)
-   * @param string $params Params
-   * @access private
-   * @return bool
-   */
-  private function mail_passthru($to, $subject, $body, $header, $params) {
-    if ( ini_get('safe_mode') || !($this->UseSendmailOptions) ) {
-        $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subject)), 
$body, $header);
-    } else {
-        $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subject)), 
$body, $header, $params);
-    }
-    return $rt;
-  }
+    /**
+     * The most recent Message-ID (including angular brackets).
+     * @type string
+     * @access protected
+     */
+    protected $lastMessageID = '';
 
-  /**
-   * Outputs debugging info via user-defined method
-   * @param string $str
-   */
-  protected function edebug($str) {
-    switch ($this->Debugoutput) {
-      case 'error_log':
-        error_log($str);
-        break;
-      case 'html':
-        //Cleans up output a bit for a better looking display that's HTML-safe
-        echo htmlentities(preg_replace('/[\r\n]+/', '', $str), ENT_QUOTES, 
$this->CharSet)."<br>\n";
-        break;
-      case 'echo':
-      default:
-        //Just echoes exactly what was received
-        echo $str;
-    }
-  }
+    /**
+     * The message's MIME type.
+     * @type string
+     * @access protected
+     */
+    protected $message_type = '';
 
-  /**
-   * Constructor
-   * @param boolean $exceptions Should we throw external exceptions?
-   */
-  public function __construct($exceptions = false) {
-    $this->exceptions = ($exceptions == true);
-  }
+    /**
+     * The array of MIME boundary strings.
+     * @type array
+     * @access protected
+     */
+    protected $boundary = array();
 
-  /**
-   * Destructor
-   */
-  public function __destruct() {
-      if ($this->Mailer == 'smtp') { //Close any open SMTP connection nicely
-          $this->SmtpClose();
-      }
-  }
+    /**
+     * The array of available languages.
+     * @type array
+     * @access protected
+     */
+    protected $language = array();
 
-  /**
-   * Sets message type to HTML.
-   * @param bool $ishtml
-   * @return void
-   */
-  public function IsHTML($ishtml = true) {
-    if ($ishtml) {
-      $this->ContentType = 'text/html';
-    } else {
-      $this->ContentType = 'text/plain';
-    }
-  }
+    /**
+     * The number of errors encountered.
+     * @type integer
+     * @access protected
+     */
+    protected $error_count = 0;
 
-  /**
-   * Sets Mailer to send message using SMTP.
-   * @return void
-   */
-  public function IsSMTP() {
-    $this->Mailer = 'smtp';
-  }
+    /**
+     * The S/MIME certificate file path.
+     * @type string
+     * @access protected
+     */
+    protected $sign_cert_file = '';
 
-  /**
-   * Sets Mailer to send message using PHP mail() function.
-   * @return void
-   */
-  public function IsMail() {
-    $this->Mailer = 'mail';
-  }
+    /**
+     * The S/MIME key file path.
+     * @type string
+     * @access protected
+     */
+    protected $sign_key_file = '';
 
-  /**
-   * Sets Mailer to send message using the $Sendmail program.
-   * @return void
-   */
-  public function IsSendmail() {
-    if (!stristr(ini_get('sendmail_path'), 'sendmail')) {
-      $this->Sendmail = '/var/qmail/bin/sendmail';
-    }
-    $this->Mailer = 'sendmail';
-  }
+    /**
+     * The S/MIME password for the key.
+     * Used only if the key is encrypted.
+     * @type string
+     * @access protected
+     */
+    protected $sign_key_pass = '';
 
-  /**
-   * Sets Mailer to send message using the qmail MTA.
-   * @return void
-   */
-  public function IsQmail() {
-    if (stristr(ini_get('sendmail_path'), 'qmail')) {
-      $this->Sendmail = '/var/qmail/bin/sendmail';
-    }
-    $this->Mailer = 'sendmail';
-  }
+    /**
+     * Whether to throw exceptions for errors.
+     * @type bool
+     * @access protected
+     */
+    protected $exceptions = false;
 
-  /////////////////////////////////////////////////
-  // METHODS, RECIPIENTS
-  /////////////////////////////////////////////////
+    /**
+     * Error severity: message only, continue processing
+     */
+    const STOP_MESSAGE = 0;
 
-  /**
-   * Adds a "To" address.
-   * @param string $address
-   * @param string $name
-   * @return boolean true on success, false if address already used
-   */
-  public function AddAddress($address, $name = '') {
-    return $this->AddAnAddress('to', $address, $name);
-  }
+    /**
+     * Error severity: message, likely ok to continue processing
+     */
+    const STOP_CONTINUE = 1;
 
-  /**
-   * Adds a "Cc" address.
-   * Note: this function works with the SMTP mailer on win32, not with the 
"mail" mailer.
-   * @param string $address
-   * @param string $name
-   * @return boolean true on success, false if address already used
-   */
-  public function AddCC($address, $name = '') {
-    return $this->AddAnAddress('cc', $address, $name);
-  }
+    /**
+     * Error severity: message, plus full stop, critical error reached
+     */
+    const STOP_CRITICAL = 2;
 
-  /**
-   * Adds a "Bcc" address.
-   * Note: this function works with the SMTP mailer on win32, not with the 
"mail" mailer.
-   * @param string $address
-   * @param string $name
-   * @return boolean true on success, false if address already used
-   */
-  public function AddBCC($address, $name = '') {
-    return $this->AddAnAddress('bcc', $address, $name);
-  }
+    /**
+     * SMTP RFC standard line ending
+     */
+    const CRLF = "\r\n";
 
-  /**
-   * Adds a "Reply-to" address.
-   * @param string $address
-   * @param string $name
-   * @return boolean
-   */
-  public function AddReplyTo($address, $name = '') {
-    return $this->AddAnAddress('Reply-To', $address, $name);
-  }
+    /**
+     * Constructor
+     * @param bool $exceptions Should we throw external exceptions?
+     */
+    public function __construct($exceptions = false)
+    {
+        $this->exceptions = ($exceptions == true);
+        //Make sure our autoloader is loaded
+        if (!in_array('PHPMailerAutoload', spl_autoload_functions())) {
+            require 'PHPMailerAutoload.php';
+        }
+    }
 
-  /**
-   * Adds an address to one of the recipient arrays
-   * Addresses that have been added already return false, but do not throw 
exceptions
-   * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo'
-   * @param string $address The email address to send to
-   * @param string $name
-   * @throws phpmailerException
-   * @return boolean true on success, false if address already used or invalid 
in some way
-   * @access protected
-   */
-  protected function AddAnAddress($kind, $address, $name = '') {
-    if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) {
-      $this->SetError($this->Lang('Invalid recipient array').': '.$kind);
-      if ($this->exceptions) {
-        throw new phpmailerException('Invalid recipient array: ' . $kind);
-      }
-      if ($this->SMTPDebug) {
-        $this->edebug($this->Lang('Invalid recipient array').': '.$kind);
-      }
-      return false;
+    /**
+     * Destructor.
+     */
+    public function __destruct()
+    {
+        if ($this->Mailer == 'smtp') { //close any open SMTP connection nicely
+            $this->smtpClose();
+        }
     }
-    $address = trim($address);
-    $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
-    if (!$this->ValidateAddress($address)) {
-      $this->SetError($this->Lang('invalid_address').': '. $address);
-      if ($this->exceptions) {
-        throw new phpmailerException($this->Lang('invalid_address').': 
'.$address);
-      }
-      if ($this->SMTPDebug) {
-        $this->edebug($this->Lang('invalid_address').': '.$address);
-      }
-      return false;
-    }
-    if ($kind != 'Reply-To') {
-      if (!isset($this->all_recipients[strtolower($address)])) {
-        array_push($this->$kind, array($address, $name));
-        $this->all_recipients[strtolower($address)] = true;
-        return true;
-      }
-    } else {
-      if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
-        $this->ReplyTo[strtolower($address)] = array($address, $name);
-      return true;
-    }
-  }
-  return false;
-}
 
-  /**
-   * Set the From and FromName properties
-   * @param string $address
-   * @param string $name
-   * @param boolean $auto Whether to also set the Sender address, defaults to 
true
-   * @throws phpmailerException
-   * @return boolean
-   */
-  public function SetFrom($address, $name = '', $auto = true) {
-    $address = trim($address);
-    $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
-    if (!$this->ValidateAddress($address)) {
-      $this->SetError($this->Lang('invalid_address').': '. $address);
-      if ($this->exceptions) {
-        throw new phpmailerException($this->Lang('invalid_address').': 
'.$address);
-      }
-      if ($this->SMTPDebug) {
-        $this->edebug($this->Lang('invalid_address').': '.$address);
-      }
-      return false;
+    /**
+     * Call mail() in a safe_mode-aware fashion.
+     * Also, unless sendmail_path points to sendmail (or something that
+     * claims to be sendmail), don't pass params (not a perfect fix,
+     * but it will do)
+     * @param string $to To
+     * @param string $subject Subject
+     * @param string $body Message Body
+     * @param string $header Additional Header(s)
+     * @param string $params Params
+     * @access private
+     * @return bool
+     */
+    private function mailPassthru($to, $subject, $body, $header, $params)
+    {
+        if (ini_get('safe_mode') || !($this->UseSendmailOptions)) {
+            $rt = @mail($to, 
$this->encodeHeader($this->secureHeader($subject)), $body, $header);
+        } else {
+            $rt = @mail($to, 
$this->encodeHeader($this->secureHeader($subject)), $body, $header, $params);
+        }
+        return $rt;
     }
-    $this->From = $address;
-    $this->FromName = $name;
-    if ($auto) {
-      if (empty($this->Sender)) {
-        $this->Sender = $address;
-      }
-    }
-    return true;
-  }
 
-  /**
-   * Check that a string looks roughly like an email address should
-   * Static so it can be used without instantiation, public so people can 
overload
-   * Conforms to RFC5322: Uses *correct* regex on which FILTER_VALIDATE_EMAIL 
is
-   * based; So why not use FILTER_VALIDATE_EMAIL? Because it was broken to
-   * not allow address@hidden type valid addresses :(
-   * @link http://squiloople.com/2009/12/20/email-address-validation/
-   * @copyright regex Copyright Michael Rushton 2009-10 | 
http://squiloople.com/ | Feel free to use and redistribute this code. But 
please keep this copyright notice.
-   * @param string $address The email address to check
-   * @return boolean
-   * @static
-   * @access public
-   */
-  public static function ValidateAddress($address) {
-      if (defined('PCRE_VERSION')) { //Check this instead of extension_loaded 
so it works when that function is disabled
-          if (version_compare(PCRE_VERSION, '8.0') >= 0) {
-              return (boolean)preg_match('/^(?!(?>(?1)"?(?>\\\[ 
-~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ 
-~]|[^"])"?(?1)){65,}@)((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t 
]*\x0D\x0A)?[\t 
]+)?)(\((?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD',
 $address);
-          } else {
-              //Fall back to an older regex that doesn't need a recent PCRE
-              return (boolean)preg_match('/^(?!(?>"?(?>\\\[ 
-~]|[^"])"?){255,})(?!(?>"?(?>\\\[ 
-~]|[^"])"?){65,}@)(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD',
 $address);
-          }
-      } else {
-          //No PCRE! Do something _very_ approximate!
-          //Check the address is 3 chars or longer and contains an @ that's 
not the first or last char
-          return (strlen($address) >= 3 and strpos($address, '@') >= 1 and 
strpos($address, '@') != strlen($address) - 1);
-      }
-  }
-
-  /////////////////////////////////////////////////
-  // METHODS, MAIL SENDING
-  /////////////////////////////////////////////////
-
-  /**
-   * Creates message and assigns Mailer. If the message is
-   * not sent successfully then it returns false.  Use the ErrorInfo
-   * variable to view description of the error.
-   * @throws phpmailerException
-   * @return bool
-   */
-  public function Send() {
-    try {
-      if(!$this->PreSend()) return false;
-      return $this->PostSend();
-    } catch (phpmailerException $e) {
-      $this->mailHeader = '';
-      $this->SetError($e->getMessage());
-      if ($this->exceptions) {
-        throw $e;
-      }
-      return false;
+    /**
+     * Output debugging info via user-defined method.
+     * Only if debug output is enabled.
+     * @see PHPMailer::$Debugoutput
+     * @see PHPMailer::$SMTPDebug
+     * @param string $str
+     */
+    protected function edebug($str)
+    {
+        if (!$this->SMTPDebug) {
+            return;
+        }
+        switch ($this->Debugoutput) {
+            case 'error_log':
+                error_log($str);
+                break;
+            case 'html':
+                //Cleans up output a bit for a better looking display that's 
HTML-safe
+                echo htmlentities(preg_replace('/[\r\n]+/', '', $str), 
ENT_QUOTES, $this->CharSet) . "<br>\n";
+                break;
+            case 'echo':
+            default:
+                //Just echoes exactly what was received
+                echo $str;
+        }
     }
-  }
 
-  /**
-   * Prep mail by constructing all message entities
-   * @throws phpmailerException
-   * @return bool
-   */
-  public function PreSend() {
-    try {
-      $this->mailHeader = "";
-      if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
-        throw new phpmailerException($this->Lang('provide_address'), 
self::STOP_CRITICAL);
-      }
-
-      // Set whether the message is multipart/alternative
-      if(!empty($this->AltBody)) {
-        $this->ContentType = 'multipart/alternative';
-      }
-
-      $this->error_count = 0; // reset errors
-      $this->SetMessageType();
-      //Refuse to send an empty message unless we are specifically allowing it
-      if (!$this->AllowEmpty and empty($this->Body)) {
-        throw new phpmailerException($this->Lang('empty_message'), 
self::STOP_CRITICAL);
-      }
-
-      $this->MIMEHeader = $this->CreateHeader();
-      $this->MIMEBody = $this->CreateBody();
-
-      // To capture the complete message when using mail(), create
-      // an extra header list which CreateHeader() doesn't fold in
-      if ($this->Mailer == 'mail') {
-        if (count($this->to) > 0) {
-          $this->mailHeader .= $this->AddrAppend("To", $this->to);
+    /**
+     * Sets message type to HTML or plain.
+     * @param bool $ishtml True for HTML mode.
+     * @return void
+     */
+    public function isHTML($ishtml = true)
+    {
+        if ($ishtml) {
+            $this->ContentType = 'text/html';
         } else {
-          $this->mailHeader .= $this->HeaderLine("To", 
"undisclosed-recipients:;");
+            $this->ContentType = 'text/plain';
         }
-        $this->mailHeader .= $this->HeaderLine('Subject', 
$this->EncodeHeader($this->SecureHeader(trim($this->Subject))));
-      }
+    }
 
-      // digitally sign with DKIM if enabled
-      if (!empty($this->DKIM_domain) && !empty($this->DKIM_private) && 
!empty($this->DKIM_selector) && !empty($this->DKIM_domain) && 
file_exists($this->DKIM_private)) {
-        $header_dkim = $this->DKIM_Add($this->MIMEHeader . $this->mailHeader, 
$this->EncodeHeader($this->SecureHeader($this->Subject)), $this->MIMEBody);
-        $this->MIMEHeader = str_replace("\r\n", "\n", $header_dkim) . 
$this->MIMEHeader;
-      }
+    /**
+     * Send messages using SMTP.
+     * @return void
+     */
+    public function isSMTP()
+    {
+        $this->Mailer = 'smtp';
+    }
 
-      return true;
-
-    } catch (phpmailerException $e) {
-      $this->SetError($e->getMessage());
-      if ($this->exceptions) {
-        throw $e;
-      }
-      return false;
+    /**
+     * Send messages using PHP's mail() function.
+     * @return void
+     */
+    public function isMail()
+    {
+        $this->Mailer = 'mail';
     }
-  }
 
-  /**
-   * Actual Email transport function
-   * Send the email via the selected mechanism
-   * @throws phpmailerException
-   * @return bool
-   */
-  public function PostSend() {
-    try {
-      // Choose the mailer and send through it
-      switch($this->Mailer) {
-        case 'sendmail':
-          return $this->SendmailSend($this->MIMEHeader, $this->MIMEBody);
-        case 'smtp':
-          return $this->SmtpSend($this->MIMEHeader, $this->MIMEBody);
-        case 'mail':
-          return $this->MailSend($this->MIMEHeader, $this->MIMEBody);
-        default:
-          return $this->MailSend($this->MIMEHeader, $this->MIMEBody);
-      }
-    } catch (phpmailerException $e) {
-      $this->SetError($e->getMessage());
-      if ($this->exceptions) {
-        throw $e;
-      }
-      if ($this->SMTPDebug) {
-        $this->edebug($e->getMessage()."\n");
-      }
+    /**
+     * Send messages using $Sendmail.
+     * @return void
+     */
+    public function isSendmail()
+    {
+        if (!stristr(ini_get('sendmail_path'), 'sendmail')) {
+            $this->Sendmail = '/var/qmail/bin/sendmail';
+        }
+        $this->Mailer = 'sendmail';
     }
-    return false;
-  }
 
-  /**
-   * Sends mail using the $Sendmail program.
-   * @param string $header The message headers
-   * @param string $body The message body
-   * @throws phpmailerException
-   * @access protected
-   * @return bool
-   */
-  protected function SendmailSend($header, $body) {
-    if ($this->Sender != '') {
-      $sendmail = sprintf("%s -oi -f%s -t", escapeshellcmd($this->Sendmail), 
escapeshellarg($this->Sender));
-    } else {
-      $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
-    }
-    if ($this->SingleTo === true) {
-      foreach ($this->SingleToArray as $val) {
-        if(address@hidden = popen($sendmail, 'w')) {
-          throw new phpmailerException($this->Lang('execute') . 
$this->Sendmail, self::STOP_CRITICAL);
+    /**
+     * Send messages using qmail.
+     * @return void
+     */
+    public function isQmail()
+    {
+        if (stristr(ini_get('sendmail_path'), 'qmail')) {
+            $this->Sendmail = '/var/qmail/bin/sendmail';
         }
-        fputs($mail, "To: " . $val . "\n");
-        fputs($mail, $header);
-        fputs($mail, $body);
-        $result = pclose($mail);
-        // implement call back function if it exists
-        $isSent = ($result == 0) ? 1 : 0;
-        $this->doCallback($isSent, $val, $this->cc, $this->bcc, 
$this->Subject, $body);
-        if($result != 0) {
-          throw new phpmailerException($this->Lang('execute') . 
$this->Sendmail, self::STOP_CRITICAL);
-        }
-      }
-    } else {
-      if(address@hidden = popen($sendmail, 'w')) {
-        throw new phpmailerException($this->Lang('execute') . $this->Sendmail, 
self::STOP_CRITICAL);
-      }
-      fputs($mail, $header);
-      fputs($mail, $body);
-      $result = pclose($mail);
-      // implement call back function if it exists
-      $isSent = ($result == 0) ? 1 : 0;
-      $this->doCallback($isSent, $this->to, $this->cc, $this->bcc, 
$this->Subject, $body);
-      if($result != 0) {
-        throw new phpmailerException($this->Lang('execute') . $this->Sendmail, 
self::STOP_CRITICAL);
-      }
+        $this->Mailer = 'sendmail';
     }
-    return true;
-  }
 
-  /**
-   * Sends mail using the PHP mail() function.
-   * @param string $header The message headers
-   * @param string $body The message body
-   * @throws phpmailerException
-   * @access protected
-   * @return bool
-   */
-  protected function MailSend($header, $body) {
-    $toArr = array();
-    foreach($this->to as $t) {
-      $toArr[] = $this->AddrFormat($t);
+    /**
+     * Add a "To" address.
+     * @param string $address
+     * @param string $name
+     * @return bool true on success, false if address already used
+     */
+    public function addAddress($address, $name = '')
+    {
+        return $this->addAnAddress('to', $address, $name);
     }
-    $to = implode(', ', $toArr);
 
-    if (empty($this->Sender)) {
-      $params = " ";
-    } else {
-      $params = sprintf("-f%s", $this->Sender);
+    /**
+     * Add a "CC" address.
+     * @note: This function works with the SMTP mailer on win32, not with the 
"mail" mailer.
+     * @param string $address
+     * @param string $name
+     * @return bool true on success, false if address already used
+     */
+    public function addCC($address, $name = '')
+    {
+        return $this->addAnAddress('cc', $address, $name);
     }
-    if ($this->Sender != '' and !ini_get('safe_mode')) {
-      $old_from = ini_get('sendmail_from');
-      ini_set('sendmail_from', $this->Sender);
+
+    /**
+     * Add a "BCC" address.
+     * @note: This function works with the SMTP mailer on win32, not with the 
"mail" mailer.
+     * @param string $address
+     * @param string $name
+     * @return bool true on success, false if address already used
+     */
+    public function addBCC($address, $name = '')
+    {
+        return $this->addAnAddress('bcc', $address, $name);
     }
-      $rt = false;
-    if ($this->SingleTo === true && count($toArr) > 1) {
-      foreach ($toArr as $val) {
-        $rt = $this->mail_passthru($val, $this->Subject, $body, $header, 
$params);
-        // implement call back function if it exists
-        $isSent = ($rt == 1) ? 1 : 0;
-        $this->doCallback($isSent, $val, $this->cc, $this->bcc, 
$this->Subject, $body);
-      }
-    } else {
-      $rt = $this->mail_passthru($to, $this->Subject, $body, $header, $params);
-      // implement call back function if it exists
-      $isSent = ($rt == 1) ? 1 : 0;
-      $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, 
$body);
-    }
-    if (isset($old_from)) {
-      ini_set('sendmail_from', $old_from);
-    }
-    if(!$rt) {
-      throw new phpmailerException($this->Lang('instantiate'), 
self::STOP_CRITICAL);
-    }
-    return true;
-  }
 
-  /**
-   * Sends mail via SMTP using PhpSMTP
-   * Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
-   * @param string $header The message headers
-   * @param string $body The message body
-   * @throws phpmailerException
-   * @uses SMTP
-   * @access protected
-   * @return bool
-   */
-  protected function SmtpSend($header, $body) {
-    require_once $this->PluginDir . 'class.smtp.php';
-    $bad_rcpt = array();
-
-    if(!$this->SmtpConnect()) {
-      throw new phpmailerException($this->Lang('smtp_connect_failed'), 
self::STOP_CRITICAL);
+    /**
+     * Add a "Reply-to" address.
+     * @param string $address
+     * @param string $name
+     * @return bool
+     */
+    public function addReplyTo($address, $name = '')
+    {
+        return $this->addAnAddress('Reply-To', $address, $name);
     }
-    $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
-    if(!$this->smtp->Mail($smtp_from)) {
-      $this->SetError($this->Lang('from_failed') . $smtp_from . ' : ' 
.implode(',', $this->smtp->getError()));
-      throw new phpmailerException($this->ErrorInfo, self::STOP_CRITICAL);
-    }
 
-    // Attempt to send attach all recipients
-    foreach($this->to as $to) {
-      if (!$this->smtp->Recipient($to[0])) {
-        $bad_rcpt[] = $to[0];
-        // implement call back function if it exists
-        $isSent = 0;
-        $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body);
-      } else {
-        // implement call back function if it exists
-        $isSent = 1;
-        $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body);
-      }
+    /**
+     * Add an address to one of the recipient arrays.
+     * Addresses that have been added already return false, but do not throw 
exceptions
+     * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo'
+     * @param string $address The email address to send to
+     * @param string $name
+     * @throws phpmailerException
+     * @return bool true on success, false if address already used or invalid 
in some way
+     * @access protected
+     */
+    protected function addAnAddress($kind, $address, $name = '')
+    {
+        if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) {
+            $this->setError($this->lang('Invalid recipient array') . ': ' . 
$kind);
+            if ($this->exceptions) {
+                throw new phpmailerException('Invalid recipient array: ' . 
$kind);
+            }
+            $this->edebug($this->lang('Invalid recipient array') . ': ' . 
$kind);
+            return false;
+        }
+        $address = trim($address);
+        $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and 
trim
+        if (!$this->validateAddress($address)) {
+            $this->setError($this->lang('invalid_address') . ': ' . $address);
+            if ($this->exceptions) {
+                throw new phpmailerException($this->lang('invalid_address') . 
': ' . $address);
+            }
+            $this->edebug($this->lang('invalid_address') . ': ' . $address);
+            return false;
+        }
+        if ($kind != 'Reply-To') {
+            if (!isset($this->all_recipients[strtolower($address)])) {
+                array_push($this->$kind, array($address, $name));
+                $this->all_recipients[strtolower($address)] = true;
+                return true;
+            }
+        } else {
+            if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
+                $this->ReplyTo[strtolower($address)] = array($address, $name);
+                return true;
+            }
+        }
+        return false;
     }
-    foreach($this->cc as $cc) {
-      if (!$this->smtp->Recipient($cc[0])) {
-        $bad_rcpt[] = $cc[0];
-        // implement call back function if it exists
-        $isSent = 0;
-        $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body);
-      } else {
-        // implement call back function if it exists
-        $isSent = 1;
-        $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body);
-      }
-    }
-    foreach($this->bcc as $bcc) {
-      if (!$this->smtp->Recipient($bcc[0])) {
-        $bad_rcpt[] = $bcc[0];
-        // implement call back function if it exists
-        $isSent = 0;
-        $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body);
-      } else {
-        // implement call back function if it exists
-        $isSent = 1;
-        $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body);
-      }
-    }
 
-
-    if (count($bad_rcpt) > 0 ) { //Create error message for any bad addresses
-      $badaddresses = implode(', ', $bad_rcpt);
-      throw new phpmailerException($this->Lang('recipients_failed') . 
$badaddresses);
+    /**
+     * Set the From and FromName properties.
+     * @param string $address
+     * @param string $name
+     * @param bool $auto Whether to also set the Sender address, defaults to 
true
+     * @throws phpmailerException
+     * @return bool
+     */
+    public function setFrom($address, $name = '', $auto = true)
+    {
+        $address = trim($address);
+        $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and 
trim
+        if (!$this->validateAddress($address)) {
+            $this->setError($this->lang('invalid_address') . ': ' . $address);
+            if ($this->exceptions) {
+                throw new phpmailerException($this->lang('invalid_address') . 
': ' . $address);
+            }
+            $this->edebug($this->lang('invalid_address') . ': ' . $address);
+            return false;
+        }
+        $this->From = $address;
+        $this->FromName = $name;
+        if ($auto) {
+            if (empty($this->Sender)) {
+                $this->Sender = $address;
+            }
+        }
+        return true;
     }
-    if(!$this->smtp->Data($header . $body)) {
-      throw new phpmailerException($this->Lang('data_not_accepted'), 
self::STOP_CRITICAL);
-    }
-    if($this->SMTPKeepAlive == true) {
-      $this->smtp->Reset();
-    } else {
-        $this->smtp->Quit();
-        $this->smtp->Close();
-    }
-    return true;
-  }
 
-  /**
-   * Initiates a connection to an SMTP server.
-   * Returns false if the operation failed.
-   * @param array $options An array of options compatible with 
stream_context_create()
-   * @uses SMTP
-   * @access public
-   * @throws phpmailerException
-   * @return bool
-   */
-  public function SmtpConnect($options = array()) {
-    if(is_null($this->smtp)) {
-      $this->smtp = new SMTP;
+    /**
+     * Return the Message-ID header of the last email.
+     * Technically this is the value from the last time the headers were 
created,
+     * but it's also the message ID of the last sent message except in
+     * pathological cases.
+     * @return string
+     */
+    public function getLastMessageID()
+    {
+        return $this->lastMessageID;
     }
 
-    //Already connected?
-    if ($this->smtp->Connected()) {
-      return true;
+    /**
+     * Check that a string looks like an email address.
+     * @param string $address The email address to check
+     * @param string $patternselect A selector for the validation pattern to 
use :
+     *   'auto' - pick best one automatically;
+     *   'pcre8' - use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 
5.3.2, 5.2.14;
+     *   'pcre' - use old PCRE implementation;
+     *   'php' - use PHP built-in FILTER_VALIDATE_EMAIL; faster, less thorough;
+     *   'noregex' - super fast, really dumb.
+     * @return bool
+     * @static
+     * @access public
+     */
+    public static function validateAddress($address, $patternselect = 'auto')
+    {
+        if ($patternselect == 'auto') {
+            if (defined(
+                'PCRE_VERSION'
+            )
+            ) { //Check this instead of extension_loaded so it works when that 
function is disabled
+                if (version_compare(PCRE_VERSION, '8.0') >= 0) {
+                    $patternselect = 'pcre8';
+                } else {
+                    $patternselect = 'pcre';
+                }
+            } else {
+                //Filter_var appeared in PHP 5.2.0 and does not require the 
PCRE extension
+                if (version_compare(PHP_VERSION, '5.2.0') >= 0) {
+                    $patternselect = 'php';
+                } else {
+                    $patternselect = 'noregex';
+                }
+            }
+        }
+        switch ($patternselect) {
+            case 'pcre8':
+                /**
+                 * Conforms to RFC5322: Uses *correct* regex on which 
FILTER_VALIDATE_EMAIL is
+                 * based; So why not use FILTER_VALIDATE_EMAIL? Because it was 
broken to
+                 * not allow address@hidden type valid addresses :(
+                 * @link 
http://squiloople.com/2009/12/20/email-address-validation/
+                 * @copyright 2009-2010 Michael Rushton
+                 * Feel free to use and redistribute this code. But please 
keep this copyright notice.
+                 */
+                return (bool)preg_match(
+                    '/^(?!(?>(?1)"?(?>\\\[ 
-~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' .
+                    '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t 
]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' .
+                    
'(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)'
 .
+                    
'([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*'
 .
+                    
'(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)'
 .
+                    
'(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}'
 .
+                    
'|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:'
 .
+                    
'|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}'
 .
+                    '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD',
+                    $address
+                );
+                break;
+            case 'pcre':
+                //An older regex that doesn't need a recent PCRE
+                return (bool)preg_match(
+                    '/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ 
-~]|[^"])"?){65,}@)(?>' .
+                    
'[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")'
 .
+                    
'(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*'
 .
+                    
'@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})'
 .
+                    
'(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:'
 .
+                    
'[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?'
 .
+                    
'::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:' 
.
+                    
'[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?'
 .
+                    
'::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}'
 .
+                    
'|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD',
+                    $address
+                );
+                break;
+            case 'php':
+            default:
+                return (bool)filter_var($address, FILTER_VALIDATE_EMAIL);
+                break;
+            case 'noregex':
+                //No PCRE! Do something _very_ approximate!
+                //Check the address is 3 chars or longer and contains an @ 
that's not the first or last char
+                return (strlen($address) >= 3
+                    and strpos($address, '@') >= 1
+                    and strpos($address, '@') != strlen($address) - 1);
+                break;
+        }
     }
 
-    $this->smtp->Timeout = $this->Timeout;
-    $this->smtp->do_debug = $this->SMTPDebug;
-    $this->smtp->Debugoutput = $this->Debugoutput;
-    $this->smtp->do_verp = $this->do_verp;
-    $index = 0;
-    $tls = ($this->SMTPSecure == 'tls');
-    $ssl = ($this->SMTPSecure == 'ssl');
-    $hosts = explode(';', $this->Host);
-    $lastexception = null;
-
-    foreach ($hosts as $hostentry) {
-      $hostinfo = array();
-      $host = $hostentry;
-      $port = $this->Port;
-      if (preg_match('/^(.+):([0-9]+)$/', $hostentry, $hostinfo)) { //If 
$hostentry contains 'address:port', override default
-        $host = $hostinfo[1];
-        $port = $hostinfo[2];
-      }
-      if ($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, 
$this->Timeout, $options)) {
+    /**
+     * Create a message and send it.
+     * Uses the sending method specified by $Mailer.
+     * Returns false on error - Use the ErrorInfo variable to view description 
of the error.
+     * @throws phpmailerException
+     * @return bool
+     */
+    public function send()
+    {
         try {
-          if ($this->Helo) {
-            $hello = $this->Helo;
-          } else {
-            $hello = $this->ServerHostname();
-          }
-          $this->smtp->Hello($hello);
-
-          if ($tls) {
-            if (!$this->smtp->StartTLS()) {
-              throw new phpmailerException($this->Lang('connect_host'));
+            if (!$this->preSend()) {
+                return false;
             }
-            //We must resend HELO after tls negotiation
-            $this->smtp->Hello($hello);
-          }
-          if ($this->SMTPAuth) {
-            if (!$this->smtp->Authenticate($this->Username, $this->Password, 
$this->AuthType, $this->Realm, $this->Workstation)) {
-              throw new phpmailerException($this->Lang('authenticate'));
+            return $this->postSend();
+        } catch (phpmailerException $e) {
+            $this->mailHeader = '';
+            $this->setError($e->getMessage());
+            if ($this->exceptions) {
+                throw $e;
             }
-          }
-          return true;
-        } catch (phpmailerException $e) {
-          $lastexception = $e;
-          //We must have connected, but then failed TLS or Auth, so close 
connection nicely
-          $this->smtp->Quit();
+            return false;
         }
-      }
     }
-    //If we get here, all connection attempts have failed, so close connection 
hard
-    $this->smtp->Close();
-    //As we've caught all exceptions, just report whatever the last one was
-    if ($this->exceptions and !is_null($lastexception)) {
-      throw $lastexception;
-    }
-    return false;
-  }
 
-  /**
-   * Closes the active SMTP session if one exists.
-   * @return void
-   */
-  public function SmtpClose() {
-    if ($this->smtp !== null) {
-      if($this->smtp->Connected()) {
-        $this->smtp->Quit();
-        $this->smtp->Close();
-      }
-    }
-  }
+    /**
+     * Prepare a message for sending.
+     * @throws phpmailerException
+     * @return bool
+     */
+    public function preSend()
+    {
+        try {
+            $this->mailHeader = "";
+            if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) 
{
+                throw new phpmailerException($this->lang('provide_address'), 
self::STOP_CRITICAL);
+            }
 
-  /**
-   * Sets the language for all class error messages.
-   * Returns false if it cannot load the language file.  The default language 
is English.
-   * @param string $langcode ISO 639-1 2-character language code (e.g. 
Portuguese: "br")
-   * @param string $lang_path Path to the language file directory
-   * @return bool
-   * @access public
-   */
-  function SetLanguage($langcode = 'en', $lang_path = 'language/') {
-    //Define full set of translatable strings
-    $PHPMAILER_LANG = array(
-      'authenticate'         => 'SMTP Error: Could not authenticate.',
-      'connect_host'         => 'SMTP Error: Could not connect to SMTP host.',
-      'data_not_accepted'    => 'SMTP Error: Data not accepted.',
-      'empty_message'        => 'Message body empty',
-      'encoding'             => 'Unknown encoding: ',
-      'execute'              => 'Could not execute: ',
-      'file_access'          => 'Could not access file: ',
-      'file_open'            => 'File Error: Could not open file: ',
-      'from_failed'          => 'The following From address failed: ',
-      'instantiate'          => 'Could not instantiate mail function.',
-      'invalid_address'      => 'Invalid address',
-      'mailer_not_supported' => ' mailer is not supported.',
-      'provide_address'      => 'You must provide at least one recipient email 
address.',
-      'recipients_failed'    => 'SMTP Error: The following recipients failed: 
',
-      'signing'              => 'Signing Error: ',
-      'smtp_connect_failed'  => 'SMTP Connect() failed.',
-      'smtp_error'           => 'SMTP server error: ',
-      'variable_set'         => 'Cannot set or reset variable: '
-    );
-    //Overwrite language-specific strings. This way we'll never have missing 
translations - no more "language string failed to load"!
-    $l = true;
-    if ($langcode != 'en') { //There is no English translation file
-      $l = @include $lang_path.'phpmailer.lang-'.$langcode.'.php';
-    }
-    $this->language = $PHPMAILER_LANG;
-    return ($l == true); //Returns false if language not found
-  }
+            // Set whether the message is multipart/alternative
+            if (!empty($this->AltBody)) {
+                $this->ContentType = 'multipart/alternative';
+            }
 
-  /**
-  * Return the current array of language strings
-  * @return array
-  */
-  public function GetTranslations() {
-    return $this->language;
-  }
+            $this->error_count = 0; // reset errors
+            $this->setMessageType();
+            // Refuse to send an empty message unless we are specifically 
allowing it
+            if (!$this->AllowEmpty and empty($this->Body)) {
+                throw new phpmailerException($this->lang('empty_message'), 
self::STOP_CRITICAL);
+            }
 
-  /////////////////////////////////////////////////
-  // METHODS, MESSAGE CREATION
-  /////////////////////////////////////////////////
+            $this->MIMEHeader = $this->createHeader();
+            $this->MIMEBody = $this->createBody();
 
-  /**
-   * Creates recipient headers.
-   * @access public
-   * @param string $type
-   * @param array $addr
-   * @return string
-   */
-  public function AddrAppend($type, $addr) {
-    $addr_str = $type . ': ';
-    $addresses = array();
-    foreach ($addr as $a) {
-      $addresses[] = $this->AddrFormat($a);
-    }
-    $addr_str .= implode(', ', $addresses);
-    $addr_str .= $this->LE;
+            // To capture the complete message when using mail(), create
+            // an extra header list which createHeader() doesn't fold in
+            if ($this->Mailer == 'mail') {
+                if (count($this->to) > 0) {
+                    $this->mailHeader .= $this->addrAppend("To", $this->to);
+                } else {
+                    $this->mailHeader .= $this->headerLine("To", 
"undisclosed-recipients:;");
+                }
+                $this->mailHeader .= $this->headerLine(
+                    'Subject',
+                    
$this->encodeHeader($this->secureHeader(trim($this->Subject)))
+                );
+            }
 
-    return $addr_str;
-  }
+            // Sign with DKIM if enabled
+            if (!empty($this->DKIM_domain)
+                && !empty($this->DKIM_private)
+                && !empty($this->DKIM_selector)
+                && !empty($this->DKIM_domain)
+                && file_exists($this->DKIM_private)) {
+                $header_dkim = $this->DKIM_Add(
+                    $this->MIMEHeader . $this->mailHeader,
+                    $this->encodeHeader($this->secureHeader($this->Subject)),
+                    $this->MIMEBody
+                );
+                $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . 
self::CRLF .
+                    str_replace("\r\n", "\n", $header_dkim) . self::CRLF;
+            }
+            return true;
 
-  /**
-   * Formats an address correctly.
-   * @access public
-   * @param string $addr
-   * @return string
-   */
-  public function AddrFormat($addr) {
-    if (empty($addr[1])) {
-      return $this->SecureHeader($addr[0]);
-    } else {
-      return $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " 
<" . $this->SecureHeader($addr[0]) . ">";
+        } catch (phpmailerException $e) {
+            $this->setError($e->getMessage());
+            if ($this->exceptions) {
+                throw $e;
+            }
+            return false;
+        }
     }
-  }
 
-  /**
-   * Wraps message for use with mailers that do not
-   * automatically perform wrapping and for quoted-printable.
-   * Original written by philippe.
-   * @param string $message The message to wrap
-   * @param integer $length The line length to wrap to
-   * @param boolean $qp_mode Whether to run in Quoted-Printable mode
-   * @access public
-   * @return string
-   */
-  public function WrapText($message, $length, $qp_mode = false) {
-    $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
-    // If utf-8 encoding is used, we will need to make sure we don't
-    // split multibyte characters when we wrap
-    $is_utf8 = (strtolower($this->CharSet) == "utf-8");
-    $lelen = strlen($this->LE);
-    $crlflen = strlen(self::CRLF);
-
-    $message = $this->FixEOL($message);
-    if (substr($message, -$lelen) == $this->LE) {
-      $message = substr($message, 0, -$lelen);
+    /**
+     * Actually send a message.
+     * Send the email via the selected mechanism
+     * @throws phpmailerException
+     * @return bool
+     */
+    public function postSend()
+    {
+        try {
+            // Choose the mailer and send through it
+            switch ($this->Mailer) {
+                case 'sendmail':
+                    return $this->sendmailSend($this->MIMEHeader, 
$this->MIMEBody);
+                case 'smtp':
+                    return $this->smtpSend($this->MIMEHeader, $this->MIMEBody);
+                case 'mail':
+                    return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
+                default:
+                    return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
+            }
+        } catch (phpmailerException $e) {
+            $this->setError($e->getMessage());
+            if ($this->exceptions) {
+                throw $e;
+            }
+            $this->edebug($e->getMessage() . "\n");
+        }
+        return false;
     }
 
-    $line = explode($this->LE, $message);   // Magic. We know FixEOL uses $LE
-    $message = '';
-    for ($i = 0 ;$i < count($line); $i++) {
-      $line_part = explode(' ', $line[$i]);
-      $buf = '';
-      for ($e = 0; $e<count($line_part); $e++) {
-        $word = $line_part[$e];
-        if ($qp_mode and (strlen($word) > $length)) {
-          $space_left = $length - strlen($buf) - $crlflen;
-          if ($e != 0) {
-            if ($space_left > 20) {
-              $len = $space_left;
-              if ($is_utf8) {
-                $len = $this->UTF8CharBoundary($word, $len);
-              } elseif (substr($word, $len - 1, 1) == "=") {
-                $len--;
-              } elseif (substr($word, $len - 2, 1) == "=") {
-                $len -= 2;
-              }
-              $part = substr($word, 0, $len);
-              $word = substr($word, $len);
-              $buf .= ' ' . $part;
-              $message .= $buf . sprintf("=%s", self::CRLF);
-            } else {
-              $message .= $buf . $soft_break;
+    /**
+     * Send mail using the $Sendmail program.
+     * @param string $header The message headers
+     * @param string $body The message body
+     * @see PHPMailer::$Sendmail
+     * @throws phpmailerException
+     * @access protected
+     * @return bool
+     */
+    protected function sendmailSend($header, $body)
+    {
+        if ($this->Sender != '') {
+            $sendmail = sprintf("%s -oi -f%s -t", 
escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
+        } else {
+            $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
+        }
+        if ($this->SingleTo === true) {
+            foreach ($this->SingleToArray as $val) {
+                if (address@hidden = popen($sendmail, 'w')) {
+                    throw new phpmailerException($this->lang('execute') . 
$this->Sendmail, self::STOP_CRITICAL);
+                }
+                fputs($mail, "To: " . $val . "\n");
+                fputs($mail, $header);
+                fputs($mail, $body);
+                $result = pclose($mail);
+                // implement call back function if it exists
+                $isSent = ($result == 0) ? 1 : 0;
+                $this->doCallback($isSent, $val, $this->cc, $this->bcc, 
$this->Subject, $body, $this->From);
+                if ($result != 0) {
+                    throw new phpmailerException($this->lang('execute') . 
$this->Sendmail, self::STOP_CRITICAL);
+                }
             }
-            $buf = '';
-          }
-          while (strlen($word) > 0) {
-            if ($length <= 0) {
-                break;
+        } else {
+            if (address@hidden = popen($sendmail, 'w')) {
+                throw new phpmailerException($this->lang('execute') . 
$this->Sendmail, self::STOP_CRITICAL);
             }
-            $len = $length;
-            if ($is_utf8) {
-              $len = $this->UTF8CharBoundary($word, $len);
-            } elseif (substr($word, $len - 1, 1) == "=") {
-              $len--;
-            } elseif (substr($word, $len - 2, 1) == "=") {
-              $len -= 2;
+            fputs($mail, $header);
+            fputs($mail, $body);
+            $result = pclose($mail);
+            // implement call back function if it exists
+            $isSent = ($result == 0) ? 1 : 0;
+            $this->doCallback($isSent, $this->to, $this->cc, $this->bcc, 
$this->Subject, $body, $this->From);
+            if ($result != 0) {
+                throw new phpmailerException($this->lang('execute') . 
$this->Sendmail, self::STOP_CRITICAL);
             }
-            $part = substr($word, 0, $len);
-            $word = substr($word, $len);
+        }
+        return true;
+    }
 
-            if (strlen($word) > 0) {
-              $message .= $part . sprintf("=%s", self::CRLF);
-            } else {
-              $buf = $part;
+    /**
+     * Send mail using the PHP mail() function.
+     * @param string $header The message headers
+     * @param string $body The message body
+     * @link http://www.php.net/manual/en/book.mail.php
+     * @throws phpmailerException
+     * @access protected
+     * @return bool
+     */
+    protected function mailSend($header, $body)
+    {
+        $toArr = array();
+        foreach ($this->to as $t) {
+            $toArr[] = $this->addrFormat($t);
+        }
+        $to = implode(', ', $toArr);
+
+        if (empty($this->Sender)) {
+            $params = " ";
+        } else {
+            $params = sprintf("-f%s", $this->Sender);
+        }
+        if ($this->Sender != '' and !ini_get('safe_mode')) {
+            $old_from = ini_get('sendmail_from');
+            ini_set('sendmail_from', $this->Sender);
+        }
+        $rt = false;
+        if ($this->SingleTo === true && count($toArr) > 1) {
+            foreach ($toArr as $val) {
+                $rt = $this->mailPassthru($val, $this->Subject, $body, 
$header, $params);
+                // implement call back function if it exists
+                $isSent = ($rt == 1) ? 1 : 0;
+                $this->doCallback($isSent, $val, $this->cc, $this->bcc, 
$this->Subject, $body, $this->From);
             }
-          }
         } else {
-          $buf_o = $buf;
-          $buf .= ($e == 0) ? $word : (' ' . $word);
+            $rt = $this->mailPassthru($to, $this->Subject, $body, $header, 
$params);
+            // implement call back function if it exists
+            $isSent = ($rt == 1) ? 1 : 0;
+            $this->doCallback($isSent, $to, $this->cc, $this->bcc, 
$this->Subject, $body, $this->From);
+        }
+        if (isset($old_from)) {
+            ini_set('sendmail_from', $old_from);
+        }
+        if (!$rt) {
+            throw new phpmailerException($this->lang('instantiate'), 
self::STOP_CRITICAL);
+        }
+        return true;
+    }
 
-          if (strlen($buf) > $length and $buf_o != '') {
-            $message .= $buf_o . $soft_break;
-            $buf = $word;
-          }
+    /**
+     * Get an instance to use for SMTP operations.
+     * Override this function to load your own SMTP implementation
+     * @return SMTP
+     */
+    public function getSMTPInstance()
+    {
+        if (!is_object($this->smtp)) {
+            $this->smtp = new SMTP;
         }
-      }
-      $message .= $buf . self::CRLF;
+        return $this->smtp;
     }
 
-    return $message;
-  }
+    /**
+     * Send mail via SMTP.
+     * Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
+     * Uses the PHPMailerSMTP class by default.
+     * @see PHPMailer::getSMTPInstance() to use a different class.
+     * @param string $header The message headers
+     * @param string $body The message body
+     * @throws phpmailerException
+     * @uses SMTP
+     * @access protected
+     * @return bool
+     */
+    protected function smtpSend($header, $body)
+    {
+        $bad_rcpt = array();
 
-  /**
-   * Finds last character boundary prior to maxLength in a utf-8
-   * quoted (printable) encoded string.
-   * Original written by Colin Brown.
-   * @access public
-   * @param string $encodedText utf-8 QP text
-   * @param int    $maxLength   find last character boundary prior to this 
length
-   * @return int
-   */
-  public function UTF8CharBoundary($encodedText, $maxLength) {
-    $foundSplitPos = false;
-    $lookBack = 3;
-    while (!$foundSplitPos) {
-      $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
-      $encodedCharPos = strpos($lastChunk, "=");
-      if ($encodedCharPos !== false) {
-        // Found start of encoded character byte within $lookBack block.
-        // Check the encoded byte value (the 2 chars after the '=')
-        $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 
1, 2);
-        $dec = hexdec($hex);
-        if ($dec < 128) { // Single byte character.
-          // If the encoded char was found at pos 0, it will fit
-          // otherwise reduce maxLength to start of the encoded char
-          $maxLength = ($encodedCharPos == 0) ? $maxLength :
-          $maxLength - ($lookBack - $encodedCharPos);
-          $foundSplitPos = true;
-        } elseif ($dec >= 192) { // First byte of a multi byte character
-          // Reduce maxLength to split at start of character
-          $maxLength = $maxLength - ($lookBack - $encodedCharPos);
-          $foundSplitPos = true;
-        } elseif ($dec < 192) { // Middle byte of a multi byte character, look 
further back
-          $lookBack += 3;
+        if (!$this->smtpConnect()) {
+            throw new phpmailerException($this->lang('smtp_connect_failed'), 
self::STOP_CRITICAL);
         }
-      } else {
-        // No encoded character found
-        $foundSplitPos = true;
-      }
-    }
-    return $maxLength;
-  }
+        $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
+        if (!$this->smtp->mail($smtp_from)) {
+            $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . 
implode(',', $this->smtp->getError()));
+            throw new phpmailerException($this->ErrorInfo, 
self::STOP_CRITICAL);
+        }
 
+        // Attempt to send attach all recipients
+        foreach ($this->to as $to) {
+            if (!$this->smtp->recipient($to[0])) {
+                $bad_rcpt[] = $to[0];
+                $isSent = 0;
+            } else {
+                $isSent = 1;
+            }
+            $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body, 
$this->From);
+        }
+        foreach ($this->cc as $cc) {
+            if (!$this->smtp->recipient($cc[0])) {
+                $bad_rcpt[] = $cc[0];
+                $isSent = 0;
+            } else {
+                $isSent = 1;
+            }
+            $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body, 
$this->From);
+        }
+        foreach ($this->bcc as $bcc) {
+            if (!$this->smtp->recipient($bcc[0])) {
+                $bad_rcpt[] = $bcc[0];
+                $isSent = 0;
+            } else {
+                $isSent = 1;
+            }
+            $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body, 
$this->From);
+        }
 
-  /**
-   * Set the body wrapping.
-   * @access public
-   * @return void
-   */
-  public function SetWordWrap() {
-    if($this->WordWrap < 1) {
-      return;
+        if (count($bad_rcpt) > 0) { //Create error message for any bad 
addresses
+            throw new phpmailerException($this->lang('recipients_failed') . 
implode(', ', $bad_rcpt));
+        }
+        if (!$this->smtp->data($header . $body)) {
+            throw new phpmailerException($this->lang('data_not_accepted'), 
self::STOP_CRITICAL);
+        }
+        if ($this->SMTPKeepAlive == true) {
+            $this->smtp->reset();
+        } else {
+            $this->smtp->quit();
+            $this->smtp->close();
+        }
+        return true;
     }
 
-    switch($this->message_type) {
-      case 'alt':
-      case 'alt_inline':
-      case 'alt_attach':
-      case 'alt_inline_attach':
-        $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
-        break;
-      default:
-        $this->Body = $this->WrapText($this->Body, $this->WordWrap);
-        break;
-    }
-  }
+    /**
+     * Initiate a connection to an SMTP server.
+     * Returns false if the operation failed.
+     * @param array $options An array of options compatible with 
stream_context_create()
+     * @uses SMTP
+     * @access public
+     * @throws phpmailerException
+     * @return bool
+     */
+    public function smtpConnect($options = array())
+    {
+        if (is_null($this->smtp)) {
+            $this->smtp = $this->getSMTPInstance();
+        }
 
-  /**
-   * Assembles message header.
-   * @access public
-   * @return string The assembled header
-   */
-  public function CreateHeader() {
-    $result = '';
+        //Already connected?
+        if ($this->smtp->connected()) {
+            return true;
+        }
 
-    // Set the boundaries
-    $uniq_id = md5(uniqid(time()));
-    $this->boundary[1] = 'b1_' . $uniq_id;
-    $this->boundary[2] = 'b2_' . $uniq_id;
-    $this->boundary[3] = 'b3_' . $uniq_id;
+        $this->smtp->setTimeout($this->Timeout);
+        $this->smtp->setDebugLevel($this->SMTPDebug);
+        $this->smtp->setDebugOutput($this->Debugoutput);
+        $this->smtp->setVerp($this->do_verp);
+        $tls = ($this->SMTPSecure == 'tls');
+        $ssl = ($this->SMTPSecure == 'ssl');
+        $hosts = explode(';', $this->Host);
+        $lastexception = null;
 
-    if ($this->MessageDate == '') {
-      $result .= $this->HeaderLine('Date', self::RFCDate());
-    } else {
-      $result .= $this->HeaderLine('Date', $this->MessageDate);
-    }
+        foreach ($hosts as $hostentry) {
+            $hostinfo = array();
+            $host = $hostentry;
+            $port = $this->Port;
+            if (preg_match(
+                '/^(.+):([0-9]+)$/',
+                $hostentry,
+                $hostinfo
+            )
+            ) { //If $hostentry contains 'address:port', override default
+                $host = $hostinfo[1];
+                $port = $hostinfo[2];
+            }
+            if ($this->smtp->connect(($ssl ? 'ssl://' : '') . $host, $port, 
$this->Timeout, $options)) {
+                try {
+                    if ($this->Helo) {
+                        $hello = $this->Helo;
+                    } else {
+                        $hello = $this->serverHostname();
+                    }
+                    $this->smtp->hello($hello);
 
-    if ($this->ReturnPath) {
-      $result .= $this->HeaderLine('Return-Path', 
'<'.trim($this->ReturnPath).'>');
-    } elseif ($this->Sender == '') {
-      $result .= $this->HeaderLine('Return-Path', '<'.trim($this->From).'>');
-    } else {
-      $result .= $this->HeaderLine('Return-Path', '<'.trim($this->Sender).'>');
-    }
-
-    // To be created automatically by mail()
-    if($this->Mailer != 'mail') {
-      if ($this->SingleTo === true) {
-        foreach($this->to as $t) {
-          $this->SingleToArray[] = $this->AddrFormat($t);
+                    if ($tls) {
+                        if (!$this->smtp->startTLS()) {
+                            throw new 
phpmailerException($this->lang('connect_host'));
+                        }
+                        //We must resend HELO after tls negotiation
+                        $this->smtp->hello($hello);
+                    }
+                    if ($this->SMTPAuth) {
+                        if (!$this->smtp->authenticate(
+                            $this->Username,
+                            $this->Password,
+                            $this->AuthType,
+                            $this->Realm,
+                            $this->Workstation
+                        )
+                        ) {
+                            throw new 
phpmailerException($this->lang('authenticate'));
+                        }
+                    }
+                    return true;
+                } catch (phpmailerException $e) {
+                    $lastexception = $e;
+                    //We must have connected, but then failed TLS or Auth, so 
close connection nicely
+                    $this->smtp->quit();
+                }
+            }
         }
-      } else {
-        if(count($this->to) > 0) {
-          $result .= $this->AddrAppend('To', $this->to);
-        } elseif (count($this->cc) == 0) {
-          $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
+        //If we get here, all connection attempts have failed, so close 
connection hard
+        $this->smtp->close();
+        //As we've caught all exceptions, just report whatever the last one was
+        if ($this->exceptions and !is_null($lastexception)) {
+            throw $lastexception;
         }
-      }
+        return false;
     }
 
-    $from = array();
-    $from[0][0] = trim($this->From);
-    $from[0][1] = $this->FromName;
-    $result .= $this->AddrAppend('From', $from);
-
-    // sendmail and mail() extract Cc from the header before sending
-    if(count($this->cc) > 0) {
-      $result .= $this->AddrAppend('Cc', $this->cc);
+    /**
+     * Close the active SMTP session if one exists.
+     * @return void
+     */
+    public function smtpClose()
+    {
+        if ($this->smtp !== null) {
+            if ($this->smtp->connected()) {
+                $this->smtp->quit();
+                $this->smtp->close();
+            }
+        }
     }
 
-    // sendmail and mail() extract Bcc from the header before sending
-    if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && 
(count($this->bcc) > 0)) {
-      $result .= $this->AddrAppend('Bcc', $this->bcc);
+    /**
+     * Set the language for error messages.
+     * Returns false if it cannot load the language file.
+     * The default language is English.
+     * @param string $langcode ISO 639-1 2-character language code (e.g. 
French is "fr")
+     * @param string $lang_path Path to the language file directory, with 
trailing separator (slash)
+     * @return bool
+     * @access public
+     */
+    public function setLanguage($langcode = 'en', $lang_path = 'language/')
+    {
+        //Define full set of translatable strings
+        $PHPMAILER_LANG = array(
+            'authenticate' => 'SMTP Error: Could not authenticate.',
+            'connect_host' => 'SMTP Error: Could not connect to SMTP host.',
+            'data_not_accepted' => 'SMTP Error: data not accepted.',
+            'empty_message' => 'Message body empty',
+            'encoding' => 'Unknown encoding: ',
+            'execute' => 'Could not execute: ',
+            'file_access' => 'Could not access file: ',
+            'file_open' => 'File Error: Could not open file: ',
+            'from_failed' => 'The following From address failed: ',
+            'instantiate' => 'Could not instantiate mail function.',
+            'invalid_address' => 'Invalid address',
+            'mailer_not_supported' => ' mailer is not supported.',
+            'provide_address' => 'You must provide at least one recipient 
email address.',
+            'recipients_failed' => 'SMTP Error: The following recipients 
failed: ',
+            'signing' => 'Signing Error: ',
+            'smtp_connect_failed' => 'SMTP connect() failed.',
+            'smtp_error' => 'SMTP server error: ',
+            'variable_set' => 'Cannot set or reset variable: '
+        );
+        //Overwrite language-specific strings.
+        //This way we'll never have missing translations - no more "language 
string failed to load"!
+        $l = true;
+        if ($langcode != 'en') { //There is no English translation file
+            $l = @include $lang_path . 'phpmailer.lang-' . $langcode . '.php';
+        }
+        $this->language = $PHPMAILER_LANG;
+        return ($l == true); //Returns false if language not found
     }
 
-    if(count($this->ReplyTo) > 0) {
-      $result .= $this->AddrAppend('Reply-To', $this->ReplyTo);
+    /**
+     * Get the array of strings for the current language.
+     * @return array
+     */
+    public function getTranslations()
+    {
+        return $this->language;
     }
 
-    // mail() sets the subject itself
-    if($this->Mailer != 'mail') {
-      $result .= $this->HeaderLine('Subject', 
$this->EncodeHeader($this->SecureHeader($this->Subject)));
+    /**
+     * Create recipient headers.
+     * @access public
+     * @param string $type
+     * @param array $addr An array of recipient,
+     * where each recipient is a 2-element indexed array with element 0 
containing an address
+     * and element 1 containing a name, like:
+     * array(array('address@hidden', 'Joe User'), array('address@hidden', 'Zoe 
User'))
+     * @return string
+     */
+    public function addrAppend($type, $addr)
+    {
+        $addresses = array();
+        foreach ($addr as $a) {
+            $addresses[] = $this->addrFormat($a);
+        }
+        return $type . ': ' . implode(', ', $addresses) . $this->LE;
     }
 
-    if($this->MessageID != '') {
-      $result .= $this->HeaderLine('Message-ID', $this->MessageID);
-    } else {
-      $result .= sprintf("Message-ID: <address@hidden>%s", $uniq_id, 
$this->ServerHostname(), $this->LE);
+    /**
+     * Format an address for use in a message header.
+     * @access public
+     * @param array $addr A 2-element indexed array, element 0 containing an 
address, element 1 containing a name
+     *      like array('address@hidden', 'Joe User')
+     * @return string
+     */
+    public function addrFormat($addr)
+    {
+        if (empty($addr[1])) { // No name provided
+            return $this->secureHeader($addr[0]);
+        } else {
+            return $this->encodeHeader($this->secureHeader($addr[1]), 
'phrase') . " <" . $this->secureHeader(
+                $addr[0]
+            ) . ">";
+        }
     }
-    $result .= $this->HeaderLine('X-Priority', $this->Priority);
-    if ($this->XMailer == '') {
-        $result .= $this->HeaderLine('X-Mailer', 'PHPMailer '.$this->Version.' 
(https://github.com/PHPMailer/PHPMailer/)');
-    } else {
-      $myXmailer = trim($this->XMailer);
-      if ($myXmailer) {
-        $result .= $this->HeaderLine('X-Mailer', $myXmailer);
-      }
-    }
 
-    if($this->ConfirmReadingTo != '') {
-      $result .= $this->HeaderLine('Disposition-Notification-To', '<' . 
trim($this->ConfirmReadingTo) . '>');
-    }
+    /**
+     * Word-wrap message.
+     * For use with mailers that do not automatically perform wrapping
+     * and for quoted-printable encoded messages.
+     * Original written by philippe.
+     * @param string $message The message to wrap
+     * @param integer $length The line length to wrap to
+     * @param bool $qp_mode Whether to run in Quoted-Printable mode
+     * @access public
+     * @return string
+     */
+    public function wrapText($message, $length, $qp_mode = false)
+    {
+        $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
+        // If utf-8 encoding is used, we will need to make sure we don't
+        // split multibyte characters when we wrap
+        $is_utf8 = (strtolower($this->CharSet) == "utf-8");
+        $lelen = strlen($this->LE);
+        $crlflen = strlen(self::CRLF);
 
-    // Add custom headers
-    for($index = 0; $index < count($this->CustomHeader); $index++) {
-      $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), 
$this->EncodeHeader(trim($this->CustomHeader[$index][1])));
-    }
-    if (!$this->sign_key_file) {
-      $result .= $this->HeaderLine('MIME-Version', '1.0');
-      $result .= $this->GetMailMIME();
-    }
+        $message = $this->fixEOL($message);
+        if (substr($message, -$lelen) == $this->LE) {
+            $message = substr($message, 0, -$lelen);
+        }
 
-    return $result;
-  }
+        $line = explode($this->LE, $message); // Magic. We know fixEOL uses $LE
+        $message = '';
+        for ($i = 0; $i < count($line); $i++) {
+            $line_part = explode(' ', $line[$i]);
+            $buf = '';
+            for ($e = 0; $e < count($line_part); $e++) {
+                $word = $line_part[$e];
+                if ($qp_mode and (strlen($word) > $length)) {
+                    $space_left = $length - strlen($buf) - $crlflen;
+                    if ($e != 0) {
+                        if ($space_left > 20) {
+                            $len = $space_left;
+                            if ($is_utf8) {
+                                $len = $this->utf8CharBoundary($word, $len);
+                            } elseif (substr($word, $len - 1, 1) == "=") {
+                                $len--;
+                            } elseif (substr($word, $len - 2, 1) == "=") {
+                                $len -= 2;
+                            }
+                            $part = substr($word, 0, $len);
+                            $word = substr($word, $len);
+                            $buf .= ' ' . $part;
+                            $message .= $buf . sprintf("=%s", self::CRLF);
+                        } else {
+                            $message .= $buf . $soft_break;
+                        }
+                        $buf = '';
+                    }
+                    while (strlen($word) > 0) {
+                        if ($length <= 0) {
+                            break;
+                        }
+                        $len = $length;
+                        if ($is_utf8) {
+                            $len = $this->utf8CharBoundary($word, $len);
+                        } elseif (substr($word, $len - 1, 1) == "=") {
+                            $len--;
+                        } elseif (substr($word, $len - 2, 1) == "=") {
+                            $len -= 2;
+                        }
+                        $part = substr($word, 0, $len);
+                        $word = substr($word, $len);
 
-  /**
-   * Returns the message MIME.
-   * @access public
-   * @return string
-   */
-  public function GetMailMIME() {
-    $result = '';
-    switch($this->message_type) {
-      case 'inline':
-        $result .= $this->HeaderLine('Content-Type', 'multipart/related;');
-        $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1].'"');
-        break;
-      case 'attach':
-      case 'inline_attach':
-      case 'alt_attach':
-      case 'alt_inline_attach':
-        $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
-        $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1].'"');
-        break;
-      case 'alt':
-      case 'alt_inline':
-        $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
-        $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1].'"');
-        break;
-      default:
-        // Catches case 'plain': and case '':
-        $result .= $this->TextLine('Content-Type: '.$this->ContentType.'; 
charset='.$this->CharSet);
-        break;
+                        if (strlen($word) > 0) {
+                            $message .= $part . sprintf("=%s", self::CRLF);
+                        } else {
+                            $buf = $part;
+                        }
+                    }
+                } else {
+                    $buf_o = $buf;
+                    $buf .= ($e == 0) ? $word : (' ' . $word);
+
+                    if (strlen($buf) > $length and $buf_o != '') {
+                        $message .= $buf_o . $soft_break;
+                        $buf = $word;
+                    }
+                }
+            }
+            $message .= $buf . self::CRLF;
+        }
+
+        return $message;
     }
-    //RFC1341 part 5 says 7bit is assumed if not specified
-    if ($this->Encoding != '7bit') {
-      $result .= $this->HeaderLine('Content-Transfer-Encoding', 
$this->Encoding);
-    }
 
-    if($this->Mailer != 'mail') {
-      $result .= $this->LE;
+    /**
+     * Find the last character boundary prior to $maxLength in a utf-8
+     * quoted (printable) encoded string.
+     * Original written by Colin Brown.
+     * @access public
+     * @param string $encodedText utf-8 QP text
+     * @param int $maxLength   find last character boundary prior to this 
length
+     * @return int
+     */
+    public function utf8CharBoundary($encodedText, $maxLength)
+    {
+        $foundSplitPos = false;
+        $lookBack = 3;
+        while (!$foundSplitPos) {
+            $lastChunk = substr($encodedText, $maxLength - $lookBack, 
$lookBack);
+            $encodedCharPos = strpos($lastChunk, "=");
+            if ($encodedCharPos !== false) {
+                // Found start of encoded character byte within $lookBack 
block.
+                // Check the encoded byte value (the 2 chars after the '=')
+                $hex = substr($encodedText, $maxLength - $lookBack + 
$encodedCharPos + 1, 2);
+                $dec = hexdec($hex);
+                if ($dec < 128) { // Single byte character.
+                    // If the encoded char was found at pos 0, it will fit
+                    // otherwise reduce maxLength to start of the encoded char
+                    $maxLength = ($encodedCharPos == 0) ? $maxLength :
+                        $maxLength - ($lookBack - $encodedCharPos);
+                    $foundSplitPos = true;
+                } elseif ($dec >= 192) { // First byte of a multi byte 
character
+                    // Reduce maxLength to split at start of character
+                    $maxLength = $maxLength - ($lookBack - $encodedCharPos);
+                    $foundSplitPos = true;
+                } elseif ($dec < 192) { // Middle byte of a multi byte 
character, look further back
+                    $lookBack += 3;
+                }
+            } else {
+                // No encoded character found
+                $foundSplitPos = true;
+            }
+        }
+        return $maxLength;
     }
 
-    return $result;
-  }
 
-  /**
-   * Returns the MIME message (headers and body). Only really valid post 
PreSend().
-   * @access public
-   * @return string
-   */
-  public function GetSentMIMEMessage() {
-    return $this->MIMEHeader . $this->mailHeader . self::CRLF . 
$this->MIMEBody;
-  }
+    /**
+     * Set the body wrapping.
+     * @access public
+     * @return void
+     */
+    public function setWordWrap()
+    {
+        if ($this->WordWrap < 1) {
+            return;
+        }
 
+        switch ($this->message_type) {
+            case 'alt':
+            case 'alt_inline':
+            case 'alt_attach':
+            case 'alt_inline_attach':
+                $this->AltBody = $this->wrapText($this->AltBody, 
$this->WordWrap);
+                break;
+            default:
+                $this->Body = $this->wrapText($this->Body, $this->WordWrap);
+                break;
+        }
+    }
 
-  /**
-   * Assembles the message body.  Returns an empty string on failure.
-   * @access public
-   * @throws phpmailerException
-   * @return string The assembled message body
-   */
-  public function CreateBody() {
-    $body = '';
+    /**
+     * Assemble message headers.
+     * @access public
+     * @return string The assembled headers
+     */
+    public function createHeader()
+    {
+        $result = '';
 
-    if ($this->sign_key_file) {
-      $body .= $this->GetMailMIME().$this->LE;
-    }
+        // Set the boundaries
+        $uniq_id = md5(uniqid(time()));
+        $this->boundary[1] = 'b1_' . $uniq_id;
+        $this->boundary[2] = 'b2_' . $uniq_id;
+        $this->boundary[3] = 'b3_' . $uniq_id;
 
-    $this->SetWordWrap();
-
-    switch($this->message_type) {
-      case 'inline':
-        $body .= $this->GetBoundary($this->boundary[1], '', '', '');
-        $body .= $this->EncodeString($this->Body, $this->Encoding);
-        $body .= $this->LE.$this->LE;
-        $body .= $this->AttachAll('inline', $this->boundary[1]);
-        break;
-      case 'attach':
-        $body .= $this->GetBoundary($this->boundary[1], '', '', '');
-        $body .= $this->EncodeString($this->Body, $this->Encoding);
-        $body .= $this->LE.$this->LE;
-        $body .= $this->AttachAll('attachment', $this->boundary[1]);
-        break;
-      case 'inline_attach':
-        $body .= $this->TextLine('--' . $this->boundary[1]);
-        $body .= $this->HeaderLine('Content-Type', 'multipart/related;');
-        $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2].'"');
-        $body .= $this->LE;
-        $body .= $this->GetBoundary($this->boundary[2], '', '', '');
-        $body .= $this->EncodeString($this->Body, $this->Encoding);
-        $body .= $this->LE.$this->LE;
-        $body .= $this->AttachAll('inline', $this->boundary[2]);
-        $body .= $this->LE;
-        $body .= $this->AttachAll('attachment', $this->boundary[1]);
-        break;
-      case 'alt':
-        $body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
-        $body .= $this->EncodeString($this->AltBody, $this->Encoding);
-        $body .= $this->LE.$this->LE;
-        $body .= $this->GetBoundary($this->boundary[1], '', 'text/html', '');
-        $body .= $this->EncodeString($this->Body, $this->Encoding);
-        $body .= $this->LE.$this->LE;
-        if(!empty($this->Ical)) {
-          $body .= $this->GetBoundary($this->boundary[1], '', 'text/calendar; 
method=REQUEST', '');
-          $body .= $this->EncodeString($this->Ical, $this->Encoding);
-          $body .= $this->LE.$this->LE;
+        if ($this->MessageDate == '') {
+            $result .= $this->headerLine('Date', self::rfcDate());
+        } else {
+            $result .= $this->headerLine('Date', $this->MessageDate);
         }
-        $body .= $this->EndBoundary($this->boundary[1]);
-        break;
-      case 'alt_inline':
-        $body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
-        $body .= $this->EncodeString($this->AltBody, $this->Encoding);
-        $body .= $this->LE.$this->LE;
-        $body .= $this->TextLine('--' . $this->boundary[1]);
-        $body .= $this->HeaderLine('Content-Type', 'multipart/related;');
-        $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2].'"');
-        $body .= $this->LE;
-        $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', '');
-        $body .= $this->EncodeString($this->Body, $this->Encoding);
-        $body .= $this->LE.$this->LE;
-        $body .= $this->AttachAll('inline', $this->boundary[2]);
-        $body .= $this->LE;
-        $body .= $this->EndBoundary($this->boundary[1]);
-        break;
-      case 'alt_attach':
-        $body .= $this->TextLine('--' . $this->boundary[1]);
-        $body .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
-        $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2].'"');
-        $body .= $this->LE;
-        $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '');
-        $body .= $this->EncodeString($this->AltBody, $this->Encoding);
-        $body .= $this->LE.$this->LE;
-        $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', '');
-        $body .= $this->EncodeString($this->Body, $this->Encoding);
-        $body .= $this->LE.$this->LE;
-        $body .= $this->EndBoundary($this->boundary[2]);
-        $body .= $this->LE;
-        $body .= $this->AttachAll('attachment', $this->boundary[1]);
-        break;
-      case 'alt_inline_attach':
-        $body .= $this->TextLine('--' . $this->boundary[1]);
-        $body .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
-        $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2].'"');
-        $body .= $this->LE;
-        $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '');
-        $body .= $this->EncodeString($this->AltBody, $this->Encoding);
-        $body .= $this->LE.$this->LE;
-        $body .= $this->TextLine('--' . $this->boundary[2]);
-        $body .= $this->HeaderLine('Content-Type', 'multipart/related;');
-        $body .= $this->TextLine("\tboundary=\"" . $this->boundary[3].'"');
-        $body .= $this->LE;
-        $body .= $this->GetBoundary($this->boundary[3], '', 'text/html', '');
-        $body .= $this->EncodeString($this->Body, $this->Encoding);
-        $body .= $this->LE.$this->LE;
-        $body .= $this->AttachAll('inline', $this->boundary[3]);
-        $body .= $this->LE;
-        $body .= $this->EndBoundary($this->boundary[2]);
-        $body .= $this->LE;
-        $body .= $this->AttachAll('attachment', $this->boundary[1]);
-        break;
-      default:
-        // catch case 'plain' and case ''
-        $body .= $this->EncodeString($this->Body, $this->Encoding);
-        break;
-    }
 
-    if ($this->IsError()) {
-      $body = '';
-    } elseif ($this->sign_key_file) {
-      try {
-        if (!defined('PKCS7_TEXT')) {
-            throw new phpmailerException($this->Lang('signing').' OpenSSL 
extension missing.');
-        }
-        $file = tempnam(sys_get_temp_dir(), 'mail');
-        file_put_contents($file, $body); //TODO check this worked
-        $signed = tempnam(sys_get_temp_dir(), 'signed');
-        if (@openssl_pkcs7_sign($file, $signed, 
'file://'.realpath($this->sign_cert_file), 
array('file://'.realpath($this->sign_key_file), $this->sign_key_pass), null)) {
-          @unlink($file);
-          $body = file_get_contents($signed);
-          @unlink($signed);
+        if ($this->ReturnPath) {
+            $result .= $this->headerLine('Return-Path', '<' . 
trim($this->ReturnPath) . '>');
+        } elseif ($this->Sender == '') {
+            $result .= $this->headerLine('Return-Path', '<' . 
trim($this->From) . '>');
         } else {
-          @unlink($file);
-          @unlink($signed);
-          throw new 
phpmailerException($this->Lang('signing').openssl_error_string());
+            $result .= $this->headerLine('Return-Path', '<' . 
trim($this->Sender) . '>');
         }
-      } catch (phpmailerException $e) {
-        $body = '';
-        if ($this->exceptions) {
-          throw $e;
+
+        // To be created automatically by mail()
+        if ($this->Mailer != 'mail') {
+            if ($this->SingleTo === true) {
+                foreach ($this->to as $t) {
+                    $this->SingleToArray[] = $this->addrFormat($t);
+                }
+            } else {
+                if (count($this->to) > 0) {
+                    $result .= $this->addrAppend('To', $this->to);
+                } elseif (count($this->cc) == 0) {
+                    $result .= $this->headerLine('To', 
'undisclosed-recipients:;');
+                }
+            }
         }
-      }
-    }
-    return $body;
-  }
 
-  /**
-   * Returns the start of a message boundary.
-   * @access protected
-   * @param string $boundary
-   * @param string $charSet
-   * @param string $contentType
-   * @param string $encoding
-   * @return string
-   */
-  protected function GetBoundary($boundary, $charSet, $contentType, $encoding) 
{
-    $result = '';
-    if($charSet == '') {
-      $charSet = $this->CharSet;
-    }
-    if($contentType == '') {
-      $contentType = $this->ContentType;
-    }
-    if($encoding == '') {
-      $encoding = $this->Encoding;
-    }
-    $result .= $this->TextLine('--' . $boundary);
-    $result .= sprintf("Content-Type: %s; charset=%s", $contentType, $charSet);
-    $result .= $this->LE;
-    $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);
-    $result .= $this->LE;
+        $result .= $this->addrAppend('From', array(array(trim($this->From), 
$this->FromName)));
 
-    return $result;
-  }
+        // sendmail and mail() extract Cc from the header before sending
+        if (count($this->cc) > 0) {
+            $result .= $this->addrAppend('Cc', $this->cc);
+        }
 
-  /**
-   * Returns the end of a message boundary.
-   * @access protected
-   * @param string $boundary
-   * @return string
-   */
-  protected function EndBoundary($boundary) {
-    return $this->LE . '--' . $boundary . '--' . $this->LE;
-  }
+        // sendmail and mail() extract Bcc from the header before sending
+        if ((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && 
(count($this->bcc) > 0)) {
+            $result .= $this->addrAppend('Bcc', $this->bcc);
+        }
 
-  /**
-   * Sets the message type.
-   * @access protected
-   * @return void
-   */
-  protected function SetMessageType() {
-    $this->message_type = array();
-    if($this->AlternativeExists()) $this->message_type[] = "alt";
-    if($this->InlineImageExists()) $this->message_type[] = "inline";
-    if($this->AttachmentExists()) $this->message_type[] = "attach";
-    $this->message_type = implode("_", $this->message_type);
-    if($this->message_type == "") $this->message_type = "plain";
-  }
+        if (count($this->ReplyTo) > 0) {
+            $result .= $this->addrAppend('Reply-To', $this->ReplyTo);
+        }
 
-  /**
-   * Returns a formatted header line.
-   * @access public
-   * @param string $name
-   * @param string $value
-   * @return string
-   */
-  public function HeaderLine($name, $value) {
-    return $name . ': ' . $value . $this->LE;
-  }
+        // mail() sets the subject itself
+        if ($this->Mailer != 'mail') {
+            $result .= $this->headerLine('Subject', 
$this->encodeHeader($this->secureHeader($this->Subject)));
+        }
 
-  /**
-   * Returns a formatted mail line.
-   * @access public
-   * @param string $value
-   * @return string
-   */
-  public function TextLine($value) {
-    return $value . $this->LE;
-  }
+        if ($this->MessageID != '') {
+            $this->lastMessageID = $this->MessageID;
+        } else {
+            $this->lastMessageID = sprintf("<address@hidden>", $uniq_id, 
$this->ServerHostname());
+        }
+        $result .= $this->HeaderLine('Message-ID', $this->lastMessageID);
+        $result .= $this->headerLine('X-Priority', $this->Priority);
+        if ($this->XMailer == '') {
+            $result .= $this->headerLine(
+                'X-Mailer',
+                'PHPMailer ' . $this->Version . ' 
(https://github.com/PHPMailer/PHPMailer/)'
+            );
+        } else {
+            $myXmailer = trim($this->XMailer);
+            if ($myXmailer) {
+                $result .= $this->headerLine('X-Mailer', $myXmailer);
+            }
+        }
 
-  /////////////////////////////////////////////////
-  // CLASS METHODS, ATTACHMENTS
-  /////////////////////////////////////////////////
+        if ($this->ConfirmReadingTo != '') {
+            $result .= $this->headerLine('Disposition-Notification-To', '<' . 
trim($this->ConfirmReadingTo) . '>');
+        }
 
-  /**
-   * Adds an attachment from a path on the filesystem.
-   * Returns false if the file could not be found
-   * or accessed.
-   * @param string $path Path to the attachment.
-   * @param string $name Overrides the attachment name.
-   * @param string $encoding File encoding (see $Encoding).
-   * @param string $type File extension (MIME) type.
-   * @param string $disposition Disposition to use
-   * @throws phpmailerException
-   * @return bool
-   */
-  public function AddAttachment($path, $name = '', $encoding = 'base64', $type 
= '', $disposition = 'attachment') {
-    try {
-      if ( address@hidden($path) ) {
-        throw new phpmailerException($this->Lang('file_access') . $path, 
self::STOP_CONTINUE);
-      }

@@ Diff output truncated at 153600 characters. @@



reply via email to

[Prev in Thread] Current Thread [Next in Thread]