Skip to content

Commit ef805e2

Browse files
committed
Removed smtpClient
1 parent 3813418 commit ef805e2

File tree

6 files changed

+24
-1143
lines changed

6 files changed

+24
-1143
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ Dependencies for `firemail`:
1010
* [mimetypes](https://github.com/Kreata/mimetypes) - Convert extensions to Content-Type values and vice versa
1111
* [addressparser](https://github.com/Kreata/addressparser) - Parse e-mail address lists
1212
* [mailcomposer](https://github.com/Kreata/mailcomposer) - Compose e-mails
13-
14-
`firemail` includes a built in SMTP client which is used to deliver a RFC2822 message composed with the help of the beforementioned modules.
13+
* [smtpclient](https://github.com/Kreata/smtpclient) - SMTP client for FirefoxOS
1514

1615
## tl;dr - send an email using firemail
1716

@@ -62,7 +61,6 @@ Opening TCP sockets to a SMTP server requires special privileges. You need to se
6261
## Documentation
6362

6463
* [Firemail API](docs/firemail.md#api)
65-
* [SMTP Client](docs/smtpClient.md)
6664

6765
## Tests
6866

docs/smtpClient.md

Lines changed: 0 additions & 158 deletions
This file was deleted.

lib/firemail.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
// AMD shim
1919
(function(root, factory) {
2020
if (typeof define === 'function' && define.amd) {
21-
define(['../../mailcomposer/mailcomposer', './smtpClient/smtpClient'], factory);
21+
define(['../../mailcomposer/mailcomposer', '../../smtpclient/smtpclient'], factory);
2222
} else {
23-
root.firemail = factory(root.mailcomposer, root.smtpClient);
23+
root.firemail = factory(root.mailcomposer, root.smtpclient);
2424
}
25-
}(this, function(mailcomposer, smtpClient) {
25+
}(this, function(mailcomposer, smtpclient) {
2626

2727
"use strict";
2828

@@ -49,15 +49,15 @@
4949
/**
5050
* SMTP client
5151
*/
52-
this._smtpClient = smtpClient(this.mail.smtp.host, this.mail.smtp.port, this.mail.smtp);
52+
this._smtpclient = smtpclient(this.mail.smtp.host, this.mail.smtp.port, this.mail.smtp);
5353

5454
// Setup SMTP events
55-
this._smtpClient.onidle = this._smtpClientOnIdle.bind(this);
56-
this._smtpClient.onclose = this._smtpClientOnClose.bind(this);
57-
this._smtpClient.onerror = this._smtpClientOnError.bind(this);
58-
this._smtpClient.ondrain = this._smtpClientOnDrain.bind(this);
59-
this._smtpClient.onready = this._smtpClientOnReady.bind(this);
60-
this._smtpClient.ondone = this._smtpClientOnDone.bind(this);
55+
this._smtpclient.onidle = this._smtpclientOnIdle.bind(this);
56+
this._smtpclient.onclose = this._smtpclientOnClose.bind(this);
57+
this._smtpclient.onerror = this._smtpclientOnError.bind(this);
58+
this._smtpclient.ondrain = this._smtpclientOnDrain.bind(this);
59+
this._smtpclient.onready = this._smtpclientOnReady.bind(this);
60+
this._smtpclient.ondone = this._smtpclientOnDone.bind(this);
6161

6262
// Setup mail composer
6363

@@ -71,14 +71,14 @@
7171
this._composer.onend = this._composerOnEnd.bind(this);
7272

7373
// Initiate mail sending by connecting to SMTP
74-
this._smtpClient.connect();
74+
this._smtpclient.connect();
7575
}
7676

7777
/**
7878
* Fired when SMTP client enters idled state (after successfull auth)
7979
* Setups the mail and transfers the envelope to SMTP
8080
*/
81-
Sendmail.prototype._smtpClientOnIdle = function(){
81+
Sendmail.prototype._smtpclientOnIdle = function(){
8282
// Set default options
8383
["subject", "from", "sender", "to", "cc", "bcc", "reply-to", "in-reply-to", "references"].forEach((function(key){
8484
if(key in this.mail){
@@ -114,21 +114,21 @@
114114
}).bind(this));
115115

116116
// send envelope to smtp
117-
this._smtpClient.useEnvelope(this._composer.getEnvelope());
117+
this._smtpclient.useEnvelope(this._composer.getEnvelope());
118118
};
119119

120120
/**
121121
* Fired when SMTP client enters Ready state (envelope has been set up and data can be sent)
122122
* Starts streaming by the mail composer
123123
*/
124-
Sendmail.prototype._smtpClientOnReady = function(){
124+
Sendmail.prototype._smtpclientOnReady = function(){
125125
this._composer.stream();
126126
};
127127

128128
/**
129129
* Fired when SMTP client emits ondrain event. Mail composer can resume streaming
130130
*/
131-
Sendmail.prototype._smtpClientOnDrain = function(){
131+
Sendmail.prototype._smtpclientOnDrain = function(){
132132
this._composer.resume();
133133
};
134134

@@ -137,9 +137,9 @@
137137
*
138138
* @param {Boolean} success If true, the mail was sent successfully
139139
*/
140-
Sendmail.prototype._smtpClientOnDone = function(success){
141-
this._smtpClient.onidle = function(){}; // prevent sending the mail again
142-
this._smtpClient.quit(); // QUIT
140+
Sendmail.prototype._smtpclientOnDone = function(success){
141+
this._smtpclient.onidle = function(){}; // prevent sending the mail again
142+
this._smtpclient.quit(); // QUIT
143143
this._returned = true;
144144
this.callback(null, success);
145145
};
@@ -149,7 +149,7 @@
149149
*
150150
* @param {Error} err Error received
151151
*/
152-
Sendmail.prototype._smtpClientOnError = function(err){
152+
Sendmail.prototype._smtpclientOnError = function(err){
153153
if(!this._returned){
154154
this._returned = true;
155155
this.callback(err);
@@ -161,7 +161,7 @@
161161
/**
162162
* Connection to the SMTP server has been closed
163163
*/
164-
Sendmail.prototype._smtpClientOnClose = function(){
164+
Sendmail.prototype._smtpclientOnClose = function(){
165165
//console.log("Connection closed");
166166
};
167167

@@ -173,7 +173,7 @@
173173
* @param {String} data Chunk to be sent to the SMTP server
174174
*/
175175
Sendmail.prototype._composerOnData = function(chunk){
176-
if(!this._smtpClient.send(chunk)){
176+
if(!this._smtpclient.send(chunk)){
177177
this._composer.suspend();
178178
}
179179
};
@@ -182,7 +182,7 @@
182182
* Fired when mail cposer has emitted the entire message
183183
*/
184184
Sendmail.prototype._composerOnEnd = function(){
185-
this._smtpClient.end();
185+
this._smtpclient.end();
186186
};
187187

188188
return function(mail, callback){

0 commit comments

Comments
 (0)