mirror of
https://github.com/moparisthebest/mail
synced 2025-02-16 15:10:10 -05:00
removed email model from send email
This commit is contained in:
parent
8f54f1c544
commit
c9522fcb5e
@ -89,7 +89,7 @@ app.Controller = function() {
|
|||||||
|
|
||||||
} else if (cmd === 'sendEmail') {
|
} else if (cmd === 'sendEmail') {
|
||||||
// list emails from folder
|
// list emails from folder
|
||||||
sendEmail(args.email, function(err) {
|
emailDao.sendEmail(args.email, function(err) {
|
||||||
callback({
|
callback({
|
||||||
err: err
|
err: err
|
||||||
});
|
});
|
||||||
@ -119,9 +119,4 @@ app.Controller = function() {
|
|||||||
emailDao.init(account, password, callback);
|
emailDao.init(account, password, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendEmail(email, callback) {
|
|
||||||
var em = new app.model.Email(email);
|
|
||||||
emailDao.sendEmail(em, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
@ -185,7 +185,7 @@ app.dao.EmailDAO = function(jsonDB, crypto, devicestorage, cloudstorage, util, k
|
|||||||
|
|
||||||
// validate email addresses
|
// validate email addresses
|
||||||
var invalidRecipient;
|
var invalidRecipient;
|
||||||
_.each(email.get('to'), function(address) {
|
_.each(email.to, function(address) {
|
||||||
if (!validateEmail(address)) {
|
if (!validateEmail(address)) {
|
||||||
invalidRecipient = address;
|
invalidRecipient = address;
|
||||||
}
|
}
|
||||||
@ -196,7 +196,7 @@ app.dao.EmailDAO = function(jsonDB, crypto, devicestorage, cloudstorage, util, k
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!validateEmail(email.get('from'))) {
|
if (!validateEmail(email.from)) {
|
||||||
callback({
|
callback({
|
||||||
errMsg: 'Invalid sender: ' + email.from
|
errMsg: 'Invalid sender: ' + email.from
|
||||||
});
|
});
|
||||||
@ -204,7 +204,7 @@ app.dao.EmailDAO = function(jsonDB, crypto, devicestorage, cloudstorage, util, k
|
|||||||
}
|
}
|
||||||
|
|
||||||
// generate a new UUID for the new email
|
// generate a new UUID for the new email
|
||||||
email.set('id', util.UUID());
|
email.id = util.UUID();
|
||||||
|
|
||||||
// send email to cloud service
|
// send email to cloud service
|
||||||
cloudstorage.putEncryptedItem(email, 'email', userId, 'outbox', function(err) {
|
cloudstorage.putEncryptedItem(email, 'email', userId, 'outbox', function(err) {
|
||||||
|
@ -164,13 +164,12 @@ asyncTest("Init", 1, function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
asyncTest("Send Plaintext Email item", 1, function() {
|
asyncTest("Send Plaintext Email item", 1, function() {
|
||||||
var email = new app.model.Email({
|
var email = {
|
||||||
id: cloudstoragedao_test.util.UUID(),
|
|
||||||
from: cloudstoragedao_test.user, // sender address
|
from: cloudstoragedao_test.user, // sender address
|
||||||
to: [cloudstoragedao_test.user], // list of receivers
|
to: [cloudstoragedao_test.user], // list of receivers
|
||||||
subject: 'Client Email DAO Test', // Subject line
|
subject: 'Client Email DAO Test', // Subject line
|
||||||
body: 'Hello world' // plaintext body
|
body: 'Hello world' // plaintext body
|
||||||
});
|
};
|
||||||
|
|
||||||
cloudstoragedao_test.emailDao.sendEmail(email, function(err) {
|
cloudstoragedao_test.emailDao.sendEmail(email, function(err) {
|
||||||
ok(!err, 'Email sent');
|
ok(!err, 'Email sent');
|
||||||
|
Loading…
Reference in New Issue
Block a user