mirror of
https://github.com/moparisthebest/mail
synced 2024-12-22 15:28:49 -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') {
|
||||
// list emails from folder
|
||||
sendEmail(args.email, function(err) {
|
||||
emailDao.sendEmail(args.email, function(err) {
|
||||
callback({
|
||||
err: err
|
||||
});
|
||||
@ -119,9 +119,4 @@ app.Controller = function() {
|
||||
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
|
||||
var invalidRecipient;
|
||||
_.each(email.get('to'), function(address) {
|
||||
_.each(email.to, function(address) {
|
||||
if (!validateEmail(address)) {
|
||||
invalidRecipient = address;
|
||||
}
|
||||
@ -196,7 +196,7 @@ app.dao.EmailDAO = function(jsonDB, crypto, devicestorage, cloudstorage, util, k
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!validateEmail(email.get('from'))) {
|
||||
if (!validateEmail(email.from)) {
|
||||
callback({
|
||||
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
|
||||
email.set('id', util.UUID());
|
||||
email.id = util.UUID();
|
||||
|
||||
// send email to cloud service
|
||||
cloudstorage.putEncryptedItem(email, 'email', userId, 'outbox', function(err) {
|
||||
|
@ -164,13 +164,12 @@ asyncTest("Init", 1, function() {
|
||||
});
|
||||
|
||||
asyncTest("Send Plaintext Email item", 1, function() {
|
||||
var email = new app.model.Email({
|
||||
id: cloudstoragedao_test.util.UUID(),
|
||||
var email = {
|
||||
from: cloudstoragedao_test.user, // sender address
|
||||
to: [cloudstoragedao_test.user], // list of receivers
|
||||
subject: 'Client Email DAO Test', // Subject line
|
||||
body: 'Hello world' // plaintext body
|
||||
});
|
||||
};
|
||||
|
||||
cloudstoragedao_test.emailDao.sendEmail(email, function(err) {
|
||||
ok(!err, 'Email sent');
|
||||
|
Loading…
Reference in New Issue
Block a user