From fae4e0db7639db81123e34fd4cfa9be37d17cdb1 Mon Sep 17 00:00:00 2001 From: rene Date: Thu, 18 Jan 2018 14:20:59 +0100 Subject: [PATCH] Bug 1294027 - use mail sender's address for SMTP MAIL FROM (updated tests). r=jorgk --- .../test/unit/data/429891_testcase.eml | 4 +- mailnews/compose/test/unit/data/message1.eml | 4 +- mailnews/compose/test/unit/test_bug155172.js | 7 ++- mailnews/compose/test/unit/test_bug474774.js | 22 ++++--- .../compose/test/unit/test_sendBackground.js | 20 +++++-- .../compose/test/unit/test_sendMailMessage.js | 57 ++++++++++++++++--- .../test/unit/test_sendMessageLater.js | 20 ++++--- .../test/unit/test_sendMessageLater2.js | 28 ++++++--- .../compose/test/unit/test_smtp8bitMime.js | 7 ++- .../compose/test/unit/test_smtpAuthMethods.js | 7 ++- .../compose/test/unit/test_smtpPassword.js | 7 ++- .../test/unit/test_smtpPasswordFailure1.js | 5 +- .../test/unit/test_smtpPasswordFailure2.js | 7 ++- .../test/unit/test_smtpPasswordFailure3.js | 5 +- mailnews/compose/test/unit/test_smtpProxy.js | 1 + 15 files changed, 144 insertions(+), 57 deletions(-) diff --git a/mailnews/compose/test/unit/data/429891_testcase.eml b/mailnews/compose/test/unit/data/429891_testcase.eml index 609857fad8..b4fb4164c9 100644 --- a/mailnews/compose/test/unit/data/429891_testcase.eml +++ b/mailnews/compose/test/unit/data/429891_testcase.eml @@ -1,5 +1,5 @@ -From: Invalid User -To: =?UTF-8?B?RnLDqcOpZGxlLCBUZXN0?= +From: Invalid User +To: =?UTF-8?B?RnLDqcOpZGxlLCBUZXN0?= Subject: Big email 012345678901234567890123456789012345678901234567890123456789 diff --git a/mailnews/compose/test/unit/data/message1.eml b/mailnews/compose/test/unit/data/message1.eml index d3447484d2..7913f5f262 100644 --- a/mailnews/compose/test/unit/data/message1.eml +++ b/mailnews/compose/test/unit/data/message1.eml @@ -1,5 +1,5 @@ -From: from@foo.invalid -To: to@foo.invalid +From: from_B@foo.invalid +To: to_B@foo.invalid Subject: test mail this email is in dos format because that is what the interface requires diff --git a/mailnews/compose/test/unit/test_bug155172.js b/mailnews/compose/test/unit/test_bug155172.js index 10e2d29175..daa6450c82 100644 --- a/mailnews/compose/test/unit/test_bug155172.js +++ b/mailnews/compose/test/unit/test_bug155172.js @@ -24,6 +24,7 @@ function promptPasswordPS(aParent, aDialogTitle, aText, aPassword, var server; +var kIdentityMail = "identity@foo.invalid"; var kSender = "from@foo.invalid"; var kTo = "to@foo.invalid"; var kUsername = "test.smtp@fakeserver"; @@ -64,7 +65,7 @@ add_task(function *() { // Start the fake SMTP server server.start(); var smtpServer = getBasicSmtpServer(server.port); - var identity = getSmtpIdentity(kSender, smtpServer); + var identity = getSmtpIdentity(kIdentityMail, smtpServer); // This time with auth test = "Auth sendMailMessage"; @@ -73,7 +74,7 @@ add_task(function *() { smtpServer.socketType = Ci.nsMsgSocketType.plain; smtpServer.username = kUsername; - MailServices.smtp.sendMailMessage(testFile, kTo, identity, + MailServices.smtp.sendMailMessage(testFile, kTo, identity, kSender, null, null, null, null, false, {}, {}); @@ -87,7 +88,7 @@ add_task(function *() { "AUTH PLAIN " + AuthPLAIN.encodeLine(kUsername, kPassword2), "AUTH LOGIN", "AUTH PLAIN " + AuthPLAIN.encodeLine(kUsername, kPassword1), - "MAIL FROM:<" + kSender + "> BODY=8BITMIME SIZE=155", + "MAIL FROM:<" + kSender + "> BODY=8BITMIME SIZE=159", "RCPT TO:<" + kTo + ">", "DATA"]); diff --git a/mailnews/compose/test/unit/test_bug474774.js b/mailnews/compose/test/unit/test_bug474774.js index d374843dfb..4d4798d68f 100644 --- a/mailnews/compose/test/unit/test_bug474774.js +++ b/mailnews/compose/test/unit/test_bug474774.js @@ -14,10 +14,13 @@ var sentFolder; var originalData; var finished = false; var identity = null; + var testFile = do_get_file("data/429891_testcase.eml"); -var kSender = "from@foo.invalid"; -var kTo = "to@foo.invalid"; +var kTestFileSender = "from_A@foo.invalid"; +var kTestFileRecipient = "to_A@foo.invalid"; + +var kIdentityMail = "identity@foo.invalid"; var msgSendLater = Cc["@mozilla.org/messengercompose/sendlater;1"] .getService(Ci.nsIMsgSendLater); @@ -57,8 +60,9 @@ msll.prototype = { do_check_transaction(server.playTransaction(), ["EHLO test", - "MAIL FROM:<" + kSender + "> BODY=8BITMIME SIZE=" + originalData.length, - "RCPT TO:<" + kTo + ">", + "MAIL FROM:<" + kTestFileSender + + "> BODY=8BITMIME SIZE=" + originalData.length, + "RCPT TO:<" + kTestFileRecipient + ">", "DATA"]); // Compare data file to what the server received @@ -183,7 +187,7 @@ function run_test() { let incomingServer = MailServices.accounts.createIncomingServer("test", "localhost", "pop3"); smtpServer = getBasicSmtpServer(0); - identity = getSmtpIdentity(kSender, smtpServer); + identity = getSmtpIdentity(kIdentityMail, smtpServer); account.addIdentity(identity); account.defaultIdentity = identity; @@ -199,8 +203,12 @@ function run_test() { var compFields = Cc["@mozilla.org/messengercompose/composefields;1"] .createInstance(Ci.nsIMsgCompFields); - compFields.from = identity.email; - compFields.to = kTo; + // Setting the compFields sender and recipient to any value is required to + // survive mime_sanity_check_fields in nsMsgCompUtils.cpp. + // Sender and recipient are required for sendMessageFile but SMTP + // transaction values will be used directly from mail body. + compFields.from = "irrelevant@foo.invalid"; + compFields.to = "irrelevant@foo.invalid"; var msgSend = Cc["@mozilla.org/messengercompose/send;1"] .createInstance(Ci.nsIMsgSend); diff --git a/mailnews/compose/test/unit/test_sendBackground.js b/mailnews/compose/test/unit/test_sendBackground.js index 23e13ff98c..2c7a09b53d 100644 --- a/mailnews/compose/test/unit/test_sendBackground.js +++ b/mailnews/compose/test/unit/test_sendBackground.js @@ -15,7 +15,10 @@ var identity = null; var testFile1 = do_get_file("data/429891_testcase.eml"); var testFile2 = do_get_file("data/message1.eml"); -var kSender = "from@foo.invalid"; +var kTestFile1Sender = "from_A@foo.invalid"; +var kTestFile1Recipient = "to_A@foo.invalid"; + +var kIdentityMail = "identity@foo.invalid"; var kTo = "to@foo.invalid"; var gMsgSendLater; @@ -56,8 +59,9 @@ msll.prototype = { do_check_transaction(server.playTransaction(), ["EHLO test", - "MAIL FROM:<" + kSender + "> BODY=8BITMIME SIZE=" + originalData.length, - "RCPT TO:<" + kTo + ">", + "MAIL FROM:<" + kTestFile1Sender + + "> BODY=8BITMIME SIZE=" + originalData.length, + "RCPT TO:<" + kTestFile1Recipient + ">", "DATA"]); // Compare data file to what the server received @@ -108,7 +112,7 @@ function run_test() { server = setupServerDaemon(); server.start(); var smtpServer = getBasicSmtpServer(server.port); - identity = getSmtpIdentity(kSender, smtpServer); + identity = getSmtpIdentity(kIdentityMail, smtpServer); account.addIdentity(identity); account.defaultIdentity = identity; @@ -124,8 +128,12 @@ function run_test() { var compFields = Cc["@mozilla.org/messengercompose/composefields;1"] .createInstance(Ci.nsIMsgCompFields); - compFields.from = identity.email; - compFields.to = kTo; + // Setting the compFields sender and recipient to any value is required to + // survive mime_sanity_check_fields in nsMsgCompUtils.cpp. + // Sender and recipient are required for sendMessageFile but SMTP + // transaction values will be used directly from mail body. + compFields.from = "irrelevant@foo.invalid"; + compFields.to = "irrelevant@foo.invalid"; var msgSend = Cc["@mozilla.org/messengercompose/send;1"] .createInstance(Ci.nsIMsgSend); diff --git a/mailnews/compose/test/unit/test_sendMailMessage.js b/mailnews/compose/test/unit/test_sendMailMessage.js index 259ba40064..5d9a01085b 100644 --- a/mailnews/compose/test/unit/test_sendMailMessage.js +++ b/mailnews/compose/test/unit/test_sendMailMessage.js @@ -11,11 +11,15 @@ Components.utils.import("resource:///modules/mailServices.js"); var test = null; var server; +var kIdentityMail = "identity@foo.invalid"; var kSender = "from@foo.invalid"; var kTo = "to@foo.invalid"; var kUsername = "testsmtp"; var kPassword = "smtptest"; +var kTestFileSender = "from_B@foo.invalid"; +var kTestFileRecipient = "to_B@foo.invalid"; + function test_RFC2821() { // Test file @@ -26,16 +30,18 @@ function test_RFC2821() { server.start(); var smtpServer = getBasicSmtpServer(server.port); - var identity = getSmtpIdentity(kSender, smtpServer); + var identity = getSmtpIdentity(kIdentityMail, smtpServer); // Handle the server in a try/catch/finally loop so that we always will stop // the server if something fails. try { - // Just a basic test to check we're sending mail correctly. test = "Basic sendMailMessage"; - MailServices.smtp.sendMailMessage(testFile, kTo, identity, + // First do test with identity email address used for smtp MAIL FROM. + Services.prefs.setBoolPref("mail.smtp.useSenderForSmtpMailFrom", false); + + MailServices.smtp.sendMailMessage(testFile, kTo, identity, kSender, null, null, null, null, false, {}, {}); @@ -43,13 +49,30 @@ function test_RFC2821() { var transaction = server.playTransaction(); do_check_transaction(transaction, ["EHLO test", - "MAIL FROM:<" + kSender + "> BODY=8BITMIME SIZE=155", + "MAIL FROM:<" + kIdentityMail + "> BODY=8BITMIME SIZE=159", "RCPT TO:<" + kTo + ">", "DATA"]); server.resetTest(); - // This time with auth + // Now do the same test with sender's email address used for smtp MAIL FROM. + Services.prefs.setBoolPref("mail.smtp.useSenderForSmtpMailFrom", true); + + MailServices.smtp.sendMailMessage(testFile, kTo, identity, kSender, + null, null, null, null, + false, {}, {}); + + server.performTest(); + + var transaction = server.playTransaction(); + do_check_transaction(transaction, ["EHLO test", + "MAIL FROM:<" + kSender + "> BODY=8BITMIME SIZE=159", + "RCPT TO:<" + kTo + ">", + "DATA"]); + + server.resetTest(); + + // This time with auth. test = "Auth sendMailMessage"; smtpServer.authMethod = Ci.nsMsgAuthMethod.passwordCleartext; @@ -57,7 +80,10 @@ function test_RFC2821() { smtpServer.username = kUsername; smtpServer.password = kPassword; - MailServices.smtp.sendMailMessage(testFile, kTo, identity, + // First do test with identity email address used for smtp MAIL FROM. + Services.prefs.setBoolPref("mail.smtp.useSenderForSmtpMailFrom", false); + + MailServices.smtp.sendMailMessage(testFile, kTo, identity, kSender, null, null, null, null, false, {}, {}); @@ -66,10 +92,27 @@ function test_RFC2821() { var transaction = server.playTransaction(); do_check_transaction(transaction, ["EHLO test", "AUTH PLAIN " + AuthPLAIN.encodeLine(kUsername, kPassword), - "MAIL FROM:<" + kSender + "> BODY=8BITMIME SIZE=155", + "MAIL FROM:<" + kIdentityMail + "> BODY=8BITMIME SIZE=159", "RCPT TO:<" + kTo + ">", "DATA"]); + server.resetTest(); + + // Now do the same test with sender's email address used for smtp MAIL FROM. + Services.prefs.setBoolPref("mail.smtp.useSenderForSmtpMailFrom", true); + + MailServices.smtp.sendMailMessage(testFile, kTo, identity, kSender, + null, null, null, null, + false, {}, {}); + + server.performTest(); + + var transaction = server.playTransaction(); + do_check_transaction(transaction, ["EHLO test", + "AUTH PLAIN " + AuthPLAIN.encodeLine(kUsername, kPassword), + "MAIL FROM:<" + kSender + "> BODY=8BITMIME SIZE=159", + "RCPT TO:<" + kTo + ">", + "DATA"]); } catch (e) { do_throw(e); diff --git a/mailnews/compose/test/unit/test_sendMessageLater.js b/mailnews/compose/test/unit/test_sendMessageLater.js index c612254e43..8cdf796945 100644 --- a/mailnews/compose/test/unit/test_sendMessageLater.js +++ b/mailnews/compose/test/unit/test_sendMessageLater.js @@ -22,9 +22,10 @@ var originalData; var finished = false; var identity = null; var testFile = do_get_file("data/429891_testcase.eml"); +var kTestFileSender = "from_A@foo.invalid"; +var kTestFileRecipient = "to_A@foo.invalid"; -var kSender = "from@foo.invalid"; -var kTo = "to@foo.invalid"; +var kIdentityMail = "identity@foo.invalid"; var kToEncodedDisplayName = "=?UTF-8?B?RnLDqcOpZGxlLCBUZXN0?="; // "Fréédle, Test" var msgSendLater = Cc["@mozilla.org/messengercompose/sendlater;1"] @@ -69,8 +70,9 @@ msll.prototype = { do_check_transaction(server.playTransaction(), ["EHLO test", - "MAIL FROM:<" + kSender + "> BODY=8BITMIME SIZE=" + originalData.length, - "RCPT TO:<" + kTo + ">", + "MAIL FROM:<" + kTestFileSender + + "> BODY=8BITMIME SIZE=" + originalData.length, + "RCPT TO:<" + kTestFileRecipient + ">", "DATA"]); // Compare data file to what the server received @@ -191,7 +193,7 @@ function run_test() { let incomingServer = MailServices.accounts.createIncomingServer("test", "localhost", "pop3"); smtpServer = getBasicSmtpServer(1); - identity = getSmtpIdentity(kSender, smtpServer); + identity = getSmtpIdentity(kIdentityMail, smtpServer); account.addIdentity(identity); account.defaultIdentity = identity; @@ -207,8 +209,12 @@ function run_test() { var compFields = Cc["@mozilla.org/messengercompose/composefields;1"] .createInstance(Ci.nsIMsgCompFields); - compFields.from = identity.email; - compFields.to = kToEncodedDisplayName + " <" + kTo + ">"; + // Setting the compFields sender and recipient to any value is required to + // survive mime_sanity_check_fields in nsMsgCompUtils.cpp. + // Sender and recipient are required for sendMessageFile but SMTP + // transaction values will be used directly from mail body. + compFields.from = "irrelevant@foo.invalid"; + compFields.to = "irrelevant@foo.invalid"; var msgSend = Cc["@mozilla.org/messengercompose/send;1"] .createInstance(Ci.nsIMsgSend); diff --git a/mailnews/compose/test/unit/test_sendMessageLater2.js b/mailnews/compose/test/unit/test_sendMessageLater2.js index 9a1807cf85..e35e7fa895 100644 --- a/mailnews/compose/test/unit/test_sendMessageLater2.js +++ b/mailnews/compose/test/unit/test_sendMessageLater2.js @@ -28,6 +28,17 @@ var gMsgFile = do_get_file("data/message1.eml"), do_get_file("data/429891_testcase.eml") ]; +var kTestFileSender = +[ + "from_B@foo.invalid", + "from_A@foo.invalid" +]; +var kTestFileRecipient = +[ + "to_B@foo.invalid", + "to_A@foo.invalid" +]; + var gMsgFileData = []; var gMsgOrder = []; var gCurTestNum = 0; @@ -39,8 +50,7 @@ var gLastSentMessage = 0; // 2 = sendUnsentMessages has exited. var gMessageSendStatus = 0; -var kSender = "from@foo.invalid"; -var kTo = "to@foo.invalid"; +var kIdentityMail = "identity@foo.invalid"; var msgSendLater = Cc["@mozilla.org/messengercompose/sendlater;1"] .getService(Ci.nsIMsgSendLater); @@ -54,8 +64,8 @@ msll.prototype = { checkMessageSend: function(aCurrentMessage) { do_check_transaction(server.playTransaction(), ["EHLO test", - "MAIL FROM:<" + kSender + "> BODY=8BITMIME SIZE=" + gMsgFileData[gMsgOrder[aCurrentMessage - 1]].length, - "RCPT TO:<" + kTo + ">", + "MAIL FROM:<" + kTestFileSender[gMsgOrder[aCurrentMessage - 1]] + "> BODY=8BITMIME SIZE=" + gMsgFileData[gMsgOrder[aCurrentMessage - 1]].length, + "RCPT TO:<" + kTestFileRecipient[gMsgOrder[aCurrentMessage - 1]] + ">", "DATA"]); // Compare data file to what the server received @@ -139,8 +149,12 @@ function sendMessageLater(aTestFileIndex) var compFields = Cc["@mozilla.org/messengercompose/composefields;1"] .createInstance(Ci.nsIMsgCompFields); - compFields.from = identity.email; - compFields.to = kTo; + // Setting the compFields sender and recipient to any value is required to + // survive mime_sanity_check_fields in nsMsgCompUtils.cpp. + // Sender and recipient are required for sendMessageFile but SMTP + // transaction values will be used directly from mail body. + compFields.from = "irrelevant@foo.invalid"; + compFields.to = "irrelevant@foo.invalid"; var msgSend = Cc["@mozilla.org/messengercompose/send;1"] .createInstance(Ci.nsIMsgSend); @@ -233,7 +247,7 @@ function run_test() { let incomingServer = MailServices.accounts.createIncomingServer("test", "localhost", "pop3"); smtpServer = getBasicSmtpServer(1); - identity = getSmtpIdentity(kSender, smtpServer); + identity = getSmtpIdentity(kIdentityMail, smtpServer); account.addIdentity(identity); account.defaultIdentity = identity; diff --git a/mailnews/compose/test/unit/test_smtp8bitMime.js b/mailnews/compose/test/unit/test_smtp8bitMime.js index 73d991031a..f346a75dff 100644 --- a/mailnews/compose/test/unit/test_smtp8bitMime.js +++ b/mailnews/compose/test/unit/test_smtp8bitMime.js @@ -11,6 +11,7 @@ Components.utils.import("resource:///modules/mailServices.js"); var test = null; var server; +var kIdentityMail = "identity@foo.invalid"; var kSender = "from@foo.invalid"; var kTo = "to@foo.invalid"; @@ -27,7 +28,7 @@ function test_8bitmime(aStrictMime, aServer8bit) { server.start(); var smtpServer = getBasicSmtpServer(server.port); - var identity = getSmtpIdentity(kSender, smtpServer); + var identity = getSmtpIdentity(kIdentityMail, smtpServer); // Handle the server in a try/catch/finally loop so that we always will stop // the server if something fails. @@ -38,7 +39,7 @@ function test_8bitmime(aStrictMime, aServer8bit) { Services.prefs.setBoolPref("mail.strictly_mime", aStrictMime); - MailServices.smtp.sendMailMessage(testFile, kTo, identity, + MailServices.smtp.sendMailMessage(testFile, kTo, identity, kSender, null, null, null, null, false, {}, {}); @@ -48,7 +49,7 @@ function test_8bitmime(aStrictMime, aServer8bit) { do_check_transaction(transaction, ["EHLO test", "MAIL FROM:<" + kSender + (!aStrictMime && aServer8bit ? - "> BODY=8BITMIME SIZE=155" : "> SIZE=155"), + "> BODY=8BITMIME SIZE=159" : "> SIZE=159"), "RCPT TO:<" + kTo + ">", "DATA"]); diff --git a/mailnews/compose/test/unit/test_smtpAuthMethods.js b/mailnews/compose/test/unit/test_smtpAuthMethods.js index 1881578ceb..7f7afbd00d 100644 --- a/mailnews/compose/test/unit/test_smtpAuthMethods.js +++ b/mailnews/compose/test/unit/test_smtpAuthMethods.js @@ -15,9 +15,10 @@ var identity; var kUsername = "fred"; var kPassword = "wilma"; +var kIdentityMail = "identity@foo.invalid"; var kSender = "from@foo.invalid"; var kTo = "to@foo.invalid"; -var MAILFROM = "MAIL FROM:<" + kSender + "> BODY=8BITMIME SIZE=155"; +var MAILFROM = "MAIL FROM:<" + kSender + "> BODY=8BITMIME SIZE=159"; var RCPTTO = "RCPT TO:<" + kTo + ">"; var AUTHPLAIN = "AUTH PLAIN " + AuthPLAIN.encodeLine(kUsername, kPassword); @@ -74,7 +75,7 @@ function nextTest() { smtpServer.authMethod = curTest.clientAuthMethod; // Run test - MailServices.smtp.sendMailMessage(testFile, kTo, identity, + MailServices.smtp.sendMailMessage(testFile, kTo, identity, kSender, null, null, null, null, false, {}, {}); server.performTest(); @@ -105,7 +106,7 @@ function run_test() { smtpServer.socketType = Ci.nsMsgSocketType.plain; smtpServer.username = kUsername; smtpServer.password = kPassword; - identity = getSmtpIdentity(kSender, smtpServer); + identity = getSmtpIdentity(kIdentityMail, smtpServer); testFile = do_get_file("data/message1.eml"); diff --git a/mailnews/compose/test/unit/test_smtpPassword.js b/mailnews/compose/test/unit/test_smtpPassword.js index b888f79906..d8e9b98339 100644 --- a/mailnews/compose/test/unit/test_smtpPassword.js +++ b/mailnews/compose/test/unit/test_smtpPassword.js @@ -9,6 +9,7 @@ load("../../../resources/passwordStorage.js"); var server; +var kIdentityMail = "identity@foo.invalid"; var kSender = "from@foo.invalid"; var kTo = "to@foo.invalid"; var kUsername = "testsmtp"; @@ -43,7 +44,7 @@ add_task(function *() { // Start the fake SMTP server server.start(); var smtpServer = getBasicSmtpServer(server.port); - var identity = getSmtpIdentity(kSender, smtpServer); + var identity = getSmtpIdentity(kIdentityMail, smtpServer); // This time with auth test = "Auth sendMailMessage"; @@ -52,7 +53,7 @@ add_task(function *() { smtpServer.socketType = Ci.nsMsgSocketType.plain; smtpServer.username = kUsername; - MailServices.smtp.sendMailMessage(testFile, kTo, identity, + MailServices.smtp.sendMailMessage(testFile, kTo, identity, kSender, null, null, null, null, false, {}, {}); @@ -61,7 +62,7 @@ add_task(function *() { var transaction = server.playTransaction(); do_check_transaction(transaction, ["EHLO test", "AUTH PLAIN " + AuthPLAIN.encodeLine(kUsername, kPassword), - "MAIL FROM:<" + kSender + "> BODY=8BITMIME SIZE=155", + "MAIL FROM:<" + kSender + "> BODY=8BITMIME SIZE=159", "RCPT TO:<" + kTo + ">", "DATA"]); diff --git a/mailnews/compose/test/unit/test_smtpPasswordFailure1.js b/mailnews/compose/test/unit/test_smtpPasswordFailure1.js index 983ed95efc..2327b8f32a 100644 --- a/mailnews/compose/test/unit/test_smtpPasswordFailure1.js +++ b/mailnews/compose/test/unit/test_smtpPasswordFailure1.js @@ -20,6 +20,7 @@ load("../../../resources/passwordStorage.js"); var server; var attempt = 0; +var kIdentityMail = "identity@foo.invalid"; var kSender = "from@foo.invalid"; var kTo = "to@foo.invalid"; var kUsername = "testsmtp"; @@ -80,7 +81,7 @@ add_task(function *() { server.start(); var smtpServer = getBasicSmtpServer(server.port); - var identity = getSmtpIdentity(kSender, smtpServer); + var identity = getSmtpIdentity(kIdentityMail, smtpServer); // Handle the server in a try/catch/finally loop so that we always will stop // the server if something fails. @@ -94,7 +95,7 @@ add_task(function *() { dump("Send\n"); - MailServices.smtp.sendMailMessage(testFile, kTo, identity, + MailServices.smtp.sendMailMessage(testFile, kTo, identity, kSender, null, null, null, null, false, {}, {}); diff --git a/mailnews/compose/test/unit/test_smtpPasswordFailure2.js b/mailnews/compose/test/unit/test_smtpPasswordFailure2.js index 4b482389c1..064aa1aa43 100644 --- a/mailnews/compose/test/unit/test_smtpPasswordFailure2.js +++ b/mailnews/compose/test/unit/test_smtpPasswordFailure2.js @@ -20,6 +20,7 @@ load("../../../resources/passwordStorage.js"); var server; var attempt = 0; +var kIdentityMail = "identity@foo.invalid"; var kSender = "from@foo.invalid"; var kTo = "to@foo.invalid"; var kUsername = "testsmtp"; @@ -95,7 +96,7 @@ add_task(function *() { // Start the fake SMTP server server.start(); var smtpServer = getBasicSmtpServer(server.port); - var identity = getSmtpIdentity(kSender, smtpServer); + var identity = getSmtpIdentity(kIdentityMail, smtpServer); // This time with auth test = "Auth sendMailMessage"; @@ -106,7 +107,7 @@ add_task(function *() { dump("Send\n"); - MailServices.smtp.sendMailMessage(testFile, kTo, identity, + MailServices.smtp.sendMailMessage(testFile, kTo, identity, kSender, null, null, null, null, false, {}, {}); @@ -126,7 +127,7 @@ add_task(function *() { "AUTH LOGIN", // then we enter the correct password "AUTH PLAIN " + AuthPLAIN.encodeLine(kUsername, kValidPassword), - "MAIL FROM:<" + kSender + "> BODY=8BITMIME SIZE=155", + "MAIL FROM:<" + kSender + "> BODY=8BITMIME SIZE=159", "RCPT TO:<" + kTo + ">", "DATA"]); diff --git a/mailnews/compose/test/unit/test_smtpPasswordFailure3.js b/mailnews/compose/test/unit/test_smtpPasswordFailure3.js index 9bfa382a72..076d4a7891 100644 --- a/mailnews/compose/test/unit/test_smtpPasswordFailure3.js +++ b/mailnews/compose/test/unit/test_smtpPasswordFailure3.js @@ -18,6 +18,7 @@ load("../../../resources/passwordStorage.js"); var server; var attempt = 0; +var kIdentityMail = "identity@foo.invalid"; var kSender = "from@foo.invalid"; var kTo = "to@foo.invalid"; var kUsername = "testsmtp"; @@ -91,7 +92,7 @@ add_task(function *() { // Start the fake SMTP server server.start(); var smtpServer = getBasicSmtpServer(server.port); - var identity = getSmtpIdentity(kSender, smtpServer); + var identity = getSmtpIdentity(kIdentityMail, smtpServer); // This time with auth test = "Auth sendMailMessage"; @@ -102,7 +103,7 @@ add_task(function *() { do_test_pending(); - MailServices.smtp.sendMailMessage(testFile, kTo, identity, + MailServices.smtp.sendMailMessage(testFile, kTo, identity, kSender, null, URLListener, null, null, false, {}, {}); diff --git a/mailnews/compose/test/unit/test_smtpProxy.js b/mailnews/compose/test/unit/test_smtpProxy.js index e08d2ff4f4..8efe50f92e 100644 --- a/mailnews/compose/test/unit/test_smtpProxy.js +++ b/mailnews/compose/test/unit/test_smtpProxy.js @@ -25,6 +25,7 @@ add_task(function* sendMessage() { var testFile = do_get_file("data/message1.eml"); var urlListener = new PromiseTestUtils.PromiseUrlListener(); MailServices.smtp.sendMailMessage(testFile, "somebody@example.org", identity, + "me@example.org", null, urlListener, null, null, false, {}, {}); yield urlListener.promise;