send mail from one user to another
This commit is contained in:
parent
ae1cc03ee4
commit
69fc2408b4
45
cloudron.js
45
cloudron.js
|
@ -33,6 +33,10 @@ function Cloudron(box) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Cloudron.prototype.fqdn = function () {
|
||||||
|
return this._box.domain;
|
||||||
|
};
|
||||||
|
|
||||||
Cloudron.prototype.adminFqdn = function () {
|
Cloudron.prototype.adminFqdn = function () {
|
||||||
return 'my' + (this._isCustomDomain ? '.' : '-') + this._box.domain;
|
return 'my' + (this._isCustomDomain ? '.' : '-') + this._box.domain;
|
||||||
};
|
};
|
||||||
|
@ -548,24 +552,6 @@ Cloudron.prototype.setDnsConfig = function (dnsConfig) {
|
||||||
common.verifyResponse2xx(res, 'Could not set dns config');
|
common.verifyResponse2xx(res, 'Could not set dns config');
|
||||||
};
|
};
|
||||||
|
|
||||||
Cloudron.prototype.checkMail = function (owner, callback) {
|
|
||||||
var imap = new ImapProbe({
|
|
||||||
user: owner.username,
|
|
||||||
password: owner.password,
|
|
||||||
host: this._adminFqdn,
|
|
||||||
port: 993, // imap port
|
|
||||||
tls: true,
|
|
||||||
tlsOptions: { rejectUnauthorized: false },
|
|
||||||
readOnly: true
|
|
||||||
});
|
|
||||||
|
|
||||||
imap.probe({
|
|
||||||
subject: new RegExp('^Hi from e2e test$'),
|
|
||||||
to: new RegExp(owner.username + '@' + this._box.domain),
|
|
||||||
body: /The release depends on you/
|
|
||||||
}, callback);
|
|
||||||
};
|
|
||||||
|
|
||||||
Cloudron.prototype.saveSieveScript = function (owner, callback) {
|
Cloudron.prototype.saveSieveScript = function (owner, callback) {
|
||||||
var authString = 'AUTHENTICATE "PLAIN" "' + new Buffer('\0' + owner.username + '\0' + owner.password).toString('base64') + '"';
|
var authString = 'AUTHENTICATE "PLAIN" "' + new Buffer('\0' + owner.username + '\0' + owner.password).toString('base64') + '"';
|
||||||
var data = '';
|
var data = '';
|
||||||
|
@ -641,9 +627,28 @@ Cloudron.prototype.sendMail = function (owner, to, callback) {
|
||||||
var mailOptions = {
|
var mailOptions = {
|
||||||
from: owner.username + '@'+ this._box.domain,
|
from: owner.username + '@'+ this._box.domain,
|
||||||
to: to,
|
to: to,
|
||||||
subject: 'Hello from e2e test',
|
subject: 'Hi from e2e test - ' + this._box.domain,
|
||||||
text: 'The release depends on you'
|
text: 'This release depends on you'
|
||||||
};
|
};
|
||||||
|
|
||||||
transport.sendMail(mailOptions, callback);
|
transport.sendMail(mailOptions, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Cloudron.prototype.checkMail = function (owner, callback) {
|
||||||
|
var imap = new ImapProbe({
|
||||||
|
user: owner.username,
|
||||||
|
password: owner.password,
|
||||||
|
host: this._adminFqdn,
|
||||||
|
port: 993, // imap port
|
||||||
|
tls: true,
|
||||||
|
tlsOptions: { rejectUnauthorized: false },
|
||||||
|
readOnly: true
|
||||||
|
});
|
||||||
|
|
||||||
|
imap.probe({
|
||||||
|
subject: new RegExp('^Hi from e2e test - ' + this._box.domain + '$'),
|
||||||
|
to: new RegExp(owner.username + '@' + this._box.domain),
|
||||||
|
body: /This release depends on you/
|
||||||
|
}, callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
|
@ -83,8 +83,8 @@ describe('Cloudron backup testing', function () {
|
||||||
|
|
||||||
it('sent mail successfully', function (done) {
|
it('sent mail successfully', function (done) {
|
||||||
imap.probe({
|
imap.probe({
|
||||||
subject: new RegExp('^Hello from e2e test$'),
|
subject: new RegExp('^Hi from e2e test$'),
|
||||||
body: /The release depends on you/
|
body: /This release depends on you/
|
||||||
}, done);
|
}, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,14 @@ describe('Cloudron user creation testing', function () {
|
||||||
cloudron.getOauthToken({ username: 'newuser', password: 'Strong?132' });
|
cloudron.getOauthToken({ username: 'newuser', password: 'Strong?132' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('can send mail from one user to another', function (done) {
|
||||||
|
cloudron.sendMail(owner, 'newuser@' + cloudron.fqdn(), done);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('can receive mail', function (done) {
|
||||||
|
cloudron.checkMail({ username: 'newuser', password: 'Strong?132' }, done);
|
||||||
|
});
|
||||||
|
|
||||||
it('can delete the cloudron', function () {
|
it('can delete the cloudron', function () {
|
||||||
appStore.deleteCloudron(box);
|
appStore.deleteCloudron(box);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue