How to use smtpClient method in mountebank

Best JavaScript code snippet using mountebank

index.js

Source:index.js Github

copy

Full Screen

1const test = require('ava');2const net = require('net');3const tls = require('tls');4const stream = require('stream');5const fs = require('fs');6const {LineBuffer} = require('line-buffer');7const {SMTPClient} = require('../src');8const buffer = new LineBuffer();9const PORT = 1025;10function createSocketServer() {11 let server = net.createServer();12 server.start = (port) => new Promise((resolve) => server.listen(PORT, resolve));13 server.stop = () => new Promise((resolve) => server.close(resolve));14 return server;15}16test.serial('`parseEnhancedReplyCode` should parse ESMTP reply code', async (t) => {17 let c = new SMTPClient();18 c._extensions = ['ENHANCEDSTATUSCODES'];19 t.is(c.parseEnhancedReplyCode('555 5.5.5 Error'), '5.5.5');20});21test.serial('`parseReplyText` should parse SMTP and ESMTP reply message', async (t) => {22 let c = new SMTPClient();23 t.is(c.parseReplyText('555 5.5.5 Error'), '5.5.5 Error');24 c._extensions = ['ENHANCEDSTATUSCODES'];25 t.is(c.parseReplyText('555 5.5.5 Error'), 'Error');26});27test.serial('`getDataSizeLimit` should return email size limit', async (t) => {28 let c = new SMTPClient();29 c._extensions = ['SIZE 100'];30 t.is(c.getDataSizeLimit(), 100);31});32test.serial('`getAuthMechanisms` should return a list of available authentication mechanisms', async (t) => {33 let c = new SMTPClient();34 c._extensions = ['AUTH login PLAIN'];35 t.deepEqual(c.getAuthMechanisms(), ['LOGIN', 'PLAIN']);36});37test.serial('`connect` should connect to the SMTP server', async (t) => {38 let s = createSocketServer();39 s.on('connection', (socket) => {40 socket.write('220 mx.test.com ESMTP\r\n');41 });42 await s.start();43 let c = new SMTPClient({port: PORT});44 t.is(await c.connect(), '220');45 await c.close();46 await s.stop();47});48test.serial('`connect` throws an error if the response code is not 2xx', async (t) => {49 let s = createSocketServer();50 s.on('connection', (socket) => {51 socket.write('300 mx.test.com ESMTP\r\n');52 });53 await s.start();54 let c = new SMTPClient({port: PORT});55 t.throws(c.connect);56 await s.stop();57});58test.serial('`helo` should send the HELO command', async (t) => {59 let s = createSocketServer();60 s.on('connection', (socket) => {61 socket.write('220 mx.test.com ESMTP\r\n');62 socket.on('data', (data) => {63 let line = buffer.feed(data)[0];64 if (!line) return;65 let isValid = line === 'HELO foo';66 let code = isValid ? '220' : '500';67 socket.write(`${code} foo\r\n`);68 });69 });70 await s.start();71 let c = new SMTPClient({port: PORT});72 await c.connect();73 t.is(await c.helo({hostname: 'foo'}), '220');74 await c.close();75 await s.stop();76});77test.serial('`helo` throws an error if the response code is not 2xx', async (t) => {78 let s = createSocketServer();79 s.on('connection', (socket) => {80 socket.write('220 mx.test.com ESMTP\r\n');81 socket.on('data', (data) => {82 socket.write(`500 foo\r\n`);83 });84 });85 await s.start();86 let c = new SMTPClient({port: PORT});87 await c.connect();88 try {89 await c.helo({hostname: 'foo'})90 }91 catch(e) {92 t.is(e.message, 'foo');93 }94 await c.close();95 await s.stop();96});97test.serial('`ehlo` should send the EHLO command and retrieve supported extensions', async (t) => {98 let s = createSocketServer();99 s.on('connection', (socket) => {100 socket.write('220 mx.test.com ESMTP\r\n');101 socket.on('data', (data) => {102 let line = buffer.feed(data)[0];103 if (!line) return;104 let isValid = line === 'EHLO foo';105 if (isValid) {106 socket.write('250-foo\r\n');107 socket.write('250-8BITMIME\r\n');108 socket.write('250 STARTTLS\r\n');109 }110 else {111 socket.write('500 foo\r\n');112 }113 });114 });115 await s.start();116 let c = new SMTPClient({port: PORT});117 await c.connect();118 t.is(c.hasExtension('8BITMIME'), false);119 t.is(c.hasExtension('STARTTLS'), false);120 t.is(await c.ehlo({hostname: 'foo'}), '250');121 t.is(c.hasExtension('8BITMIME'), true);122 t.is(c.hasExtension('STARTTLS'), true);123 await c.close();124 await s.stop();125});126test.serial('`ehlo` throws an error if the response code is not 2xx', async (t) => {127 let s = createSocketServer();128 s.on('connection', (socket) => {129 socket.write('220 mx.test.com ESMTP\r\n');130 socket.on('data', (data) => {131 socket.write(`500 foo\r\n`);132 });133 });134 await s.start();135 let c = new SMTPClient({port: PORT});136 await c.connect();137 try {138 await c.ehlo({hostname: 'foo'})139 }140 catch(e) {141 t.is(e.message, 'foo');142 }143 await c.close();144 await s.stop();145});146test.serial('`greet` should send the EHLO command and retrieve supported extensions', async (t) => {147 let s = createSocketServer();148 s.on('connection', (socket) => {149 socket.write('220 mx.test.com ESMTP\r\n');150 socket.on('data', (data) => {151 let line = buffer.feed(data)[0];152 if (!line) return;153 let isValid = line === 'EHLO foo';154 if (isValid) {155 socket.write('250-foo\r\n');156 socket.write('250-8BITMIME\r\n');157 socket.write('250 STARTTLS\r\n');158 }159 else {160 socket.write('500 foo\r\n');161 }162 });163 });164 await s.start();165 let c = new SMTPClient({port: PORT});166 await c.connect();167 t.is(c.hasExtension('8BITMIME'), false);168 t.is(c.hasExtension('STARTTLS'), false);169 t.is(await c.greet({hostname: 'foo'}), '250');170 t.is(c.hasExtension('8BITMIME'), true);171 t.is(c.hasExtension('STARTTLS'), true);172 await c.close();173 await s.stop();174});175test.serial('`greet` should fall back to HELO when EHLO is not supported', async (t) => {176 let s = createSocketServer();177 s.on('connection', (socket) => {178 socket.write('220 mx.test.com ESMTP\r\n');179 socket.on('data', (data) => {180 let line = buffer.feed(data)[0];181 if (!line) return;182 let isValid = line === 'HELO foo';183 let code = isValid ? '500' : '220';184 socket.write(`${code} foo\r\n`);185 });186 });187 await s.start();188 let c = new SMTPClient({port: PORT});189 await c.connect();190 t.is(c.hasExtension('8BITMIME'), false);191 t.is(c.hasExtension('STARTTLS'), false);192 t.is(await c.greet(), '220');193 t.is(c.hasExtension('8BITMIME'), false);194 t.is(c.hasExtension('STARTTLS'), false);195 await c.close();196 await s.stop();197});198test.serial('`greet` throws an error if the response code is not 2xx', async (t) => {199 let s = createSocketServer();200 s.on('connection', (socket) => {201 socket.write('220 mx.test.com ESMTP\r\n');202 socket.on('data', (data) => {203 socket.write(`500 foo\r\n`);204 });205 });206 await s.start();207 let c = new SMTPClient({port: PORT});208 await c.connect();209 try {210 await c.greet({hostname: 'foo'})211 }212 catch(e) {213 t.is(e.message, 'foo');214 }215 await c.close();216 await s.stop();217});218test.serial('`mail` should send the MAIL command', async (t) => {219 let s = createSocketServer();220 s.on('connection', (socket) => {221 socket.write('220 mx.test.com ESMTP\r\n');222 socket.on('data', (data) => {223 let line = buffer.feed(data)[0];224 if (!line) return;225 let parts = line.split(/:<|>/);226 let isValid = (227 parts[0] === 'MAIL FROM'228 && parts[1] === 'foo'229 && parts[2] === ''230 );231 let code = isValid ? '250' : '500';232 socket.write(`${code} foo\r\n`);233 });234 });235 await s.start();236 let c = new SMTPClient({port: PORT});237 await c.connect();238 t.is(await c.mail({from: 'foo'}), '250');239 await c.close();240 await s.stop();241});242test.serial('`mail` throws an error if the response code is not 2xx', async (t) => {243 let s = createSocketServer();244 s.on('connection', (socket) => {245 socket.write('220 mx.test.com ESMTP\r\n');246 socket.on('data', (data) => {247 socket.write(`500 foo\r\n`);248 });249 });250 await s.start();251 let c = new SMTPClient({port: PORT});252 await c.connect();253 try {254 await c.mail({from: 'foo'})255 }256 catch(e) {257 t.is(e.message, 'foo');258 }259 await c.close();260 await s.stop();261});262test.serial('`rcpt` should send the RCPT command', async (t) => {263 let s = createSocketServer();264 s.on('connection', (socket) => {265 socket.write('220 mx.test.com ESMTP\r\n');266 socket.on('data', (data) => {267 let line = buffer.feed(data)[0];268 if (!line) return;269 let parts = line.split(/:<|>/);270 let isValid = (271 parts[0] === 'RCPT TO'272 && parts[1] === 'foo'273 && parts[2] === ''274 );275 let code = isValid ? '250' : '500';276 socket.write(`${code} foo\r\n`);277 });278 });279 await s.start();280 let c = new SMTPClient({port: PORT});281 await c.connect();282 t.is(await c.rcpt({to: 'foo'}), '250');283 await c.close();284 await s.stop();285});286test.serial('`rcpt` throws an error if the response code is not 2xx', async (t) => {287 let s = createSocketServer();288 s.on('connection', (socket) => {289 socket.write('220 mx.test.com ESMTP\r\n');290 socket.on('data', (data) => {291 socket.write(`500 foo\r\n`);292 });293 });294 await s.start();295 let c = new SMTPClient({port: PORT});296 await c.connect();297 try {298 await c.rcpt({to: 'foo'})299 }300 catch(e) {301 t.is(e.message, 'foo');302 }303 await c.close();304 await s.stop();305});306test.serial('`noop` should send the NOOP command (ping)', async (t) => {307 let s = createSocketServer();308 s.on('connection', (socket) => {309 socket.write('220 mx.test.com ESMTP\r\n');310 socket.on('data', (data) => {311 let line = buffer.feed(data)[0];312 if (!line) return;313 let isValid = line === 'NOOP';314 let code = isValid ? '250' : '500';315 socket.write(`${code} foo\r\n`);316 });317 });318 await s.start();319 let c = new SMTPClient({port: PORT});320 await c.connect();321 t.is(await c.noop(), '250');322 await c.close();323 await s.stop();324});325test.serial('`noop` throws an error if the response code is not 2xx', async (t) => {326 let s = createSocketServer();327 s.on('connection', (socket) => {328 socket.write('220 mx.test.com ESMTP\r\n');329 socket.on('data', (data) => {330 socket.write(`500 foo\r\n`);331 });332 });333 await s.start();334 let c = new SMTPClient({port: PORT});335 await c.connect();336 try {337 await c.noop()338 }339 catch(e) {340 t.is(e.message, 'foo');341 }342 await c.close();343 await s.stop();344});345test.serial('`rset` should send the RSET command (reset/flush)', async (t) => {346 let s = createSocketServer();347 s.on('connection', (socket) => {348 socket.write('220 mx.test.com ESMTP\r\n');349 socket.on('data', (data) => {350 let line = buffer.feed(data)[0];351 if (!line) return;352 let isValid = line === 'RSET';353 let code = isValid ? '250' : '500';354 socket.write(`${code} foo\r\n`);355 });356 });357 await s.start();358 let c = new SMTPClient({port: PORT});359 await c.connect();360 t.is(await c.rset(), '250');361 await c.close();362 await s.stop();363});364test.serial('`rset` throws an error if the response code is not 2xx', async (t) => {365 let s = createSocketServer();366 s.on('connection', (socket) => {367 socket.write('220 mx.test.com ESMTP\r\n');368 socket.on('data', (data) => {369 socket.write(`500 foo\r\n`);370 });371 });372 await s.start();373 let c = new SMTPClient({port: PORT});374 await c.connect();375 try {376 await c.rset()377 }378 catch(e) {379 t.is(e.message, 'foo');380 }381 await c.close();382 await s.stop();383});384test.serial('`quit` should send the QUIT command', async (t) => {385 let s = createSocketServer();386 s.on('connection', (socket) => {387 socket.write('220 mx.test.com ESMTP\r\n');388 socket.on('data', (data) => {389 let line = buffer.feed(data)[0];390 if (!line) return;391 let isValid = line === 'QUIT';392 let code = isValid ? '221' : '500';393 socket.write(`${code} foo\r\n`);394 });395 });396 await s.start();397 let c = new SMTPClient({port: PORT});398 await c.connect();399 t.is(await c.quit(), '221');400 await c.close();401 await s.stop();402});403test.serial('`quit` throws an error if the response code is not 2xx', async (t) => {404 let s = createSocketServer();405 s.on('connection', (socket) => {406 socket.write('220 mx.test.com ESMTP\r\n');407 socket.on('data', (data) => {408 socket.write(`500-foo bar\r\n`);409 socket.write(`500 fin\r\n`);410 });411 });412 await s.start();413 let c = new SMTPClient({port: PORT});414 await c.connect();415 try {416 await c.quit()417 }418 catch(e) {419 t.is(e.message, 'foo bar fin');420 }421 await c.close();422 await s.stop();423});424test.serial('`data` should send the DATA command with the appended "." at the end', async (t) => {425 let s = createSocketServer();426 s.on('connection', (socket) => {427 socket.write('220 mx.test.com ESMTP\r\n');428 socket.on('data', (data) => {429 let lines = buffer.feed(data);430 if (lines === 0) return;431 if (lines[0] === 'DATA') {432 socket.write(`354 foo\r\n`);433 }434 else if (lines.indexOf('.') !== -1){435 socket.write(`250 foo\r\n`);436 }437 });438 });439 await s.start();440 let c = new SMTPClient({port: PORT});441 await c.connect();442 t.is(await c.data('bar'), '250');443 await c.close();444 await s.stop();445});446test.serial('`data` throws an error if the response code is not 2xx/3xx', async (t) => {447 let s = createSocketServer();448 s.on('connection', (socket) => {449 socket.write('220 mx.test.com ESMTP\r\n');450 socket.on('data', (data) => {451 socket.write(`500 foo\r\n`);452 });453 });454 await s.start();455 let c = new SMTPClient({port: PORT});456 await c.connect();457 try {458 await c.data()459 }460 catch(e) {461 t.is(e.message, 'foo');462 }463 await c.close();464 await s.stop();465});466test.serial('`data` throws an error if the source size exceeds the allowable limit', async (t) => {467 let c = new SMTPClient({port: PORT});468 c._extensions = ['SIZE 10'];469 try {470 await c.data(null, {sourceSize: 100});471 }472 catch(e) {473 t.is(e.message, 'Message size exceeds the allowable limit (10 bytes)');474 }475});476test.serial('`authPlain` should send the AUTH PLAIN command', async (t) => {477 let s = createSocketServer();478 s.on('connection', (socket) => {479 socket.write('220 mx.test.com ESMTP\r\n');480 socket.on('data', (data) => {481 let line = buffer.feed(data)[0];482 if (!line) return;483 if (line === 'AUTH PLAIN AGZvbwBiYXI=') {484 socket.write(`235 Accepted\r\n`);485 }486 else {487 socket.write(`500 Error\r\n`);488 }489 });490 });491 await s.start();492 let c = new SMTPClient({port: PORT});493 c._extensions = ['AUTH PLAIN'];494 await c.connect();495 t.is(await c.authPlain({username: 'foo', password: 'bar'}), '235');496 await c.close();497 await s.stop();498});499test.serial('`authPlain` throws an error if the response code is not 2xx', async (t) => {500 let s = createSocketServer();501 s.on('connection', (socket) => {502 socket.write('220 mx.test.com ESMTP\r\n');503 socket.on('data', (data) => {504 socket.write(`500 foo bar\r\n`);505 });506 });507 await s.start();508 let c = new SMTPClient({port: PORT});509 c._extensions = ['AUTH PLAIN'];510 await c.connect();511 try {512 await c.authPlain();513 }514 catch(e) {515 t.is(e.message, 'foo bar');516 }517 await c.close();518 await s.stop();519});520test.serial('`authLogin` should send the AUTH LOGIN command', async (t) => {521 let s = createSocketServer();522 s.on('connection', (socket) => {523 socket.write('220 mx.test.com ESMTP\r\n');524 socket.on('data', (data) => {525 let line = buffer.feed(data)[0];526 if (!line) return;527 if (line === 'AUTH LOGIN') {528 socket.write(`334 VXNlcm5hbWU6\r\n`);529 }530 else if (line === 'Zm9v') {531 socket.write(`334 UGFzc3dvcmQ6\r\n`);532 }533 else if (line === 'YmFy') {534 socket.write(`235 Accepted\r\n`);535 }536 else {537 socket.write(`500 Error\r\n`);538 }539 });540 });541 await s.start();542 let c = new SMTPClient({port: PORT});543 c._extensions = ['AUTH LOGIN'];544 await c.connect();545 t.is(await c.authLogin({username: 'foo', password: 'bar'}), '235');546 await c.close();547 await s.stop();548});549test.serial('`authLogin` throws an error if the response code is not 2xx', async (t) => {550 let s = createSocketServer();551 s.on('connection', (socket) => {552 socket.write('220 mx.test.com ESMTP\r\n');553 socket.on('data', (data) => {554 socket.write(`500 foo bar\r\n`);555 });556 });557 await s.start();558 let c = new SMTPClient({port: PORT});559 c._extensions = ['AUTH LOGIN'];560 await c.connect();561 try {562 await c.authLogin();563 }564 catch(e) {565 t.is(e.message, 'foo bar');566 }567 await c.close();568 await s.stop();569});570// test.serial('`secure` should upgrade the client to TLS', async (t) => {571// let s = createSocketServer();572// s.on('connection', (socket) => {573// socket.write('220 mx.test.com ESMTP\r\n');574// socket.on('data', (data) => {575// let line = buffer.feed(data)[0];576// if (!line) return;577//578// if (line === 'STARTTLS') {579// socket.write(`220 foo\r\n`);580//581// let starttls = require('starttls');582// starttls({583// socket,584// isServer: true,585// server: s,586// rejectUnauthorized: false587// });588// }589// else {590// socket.write(`250 foo\r\n`);591// }592// });593// });594// await s.start();595//596// let c = new SMTPClient({port: PORT});597// c._extensions = ['STARTTLS'];598// await c.connect();599//600// t.is(c.isSecure(), false);601// t.is(await c.secure(), '220');602// t.is(c.isSecure(), true);603//604// await c.close();605// await s.stop();606// });607test.serial('`secure` throws an error if the response code is not 2xx', async (t) => {608 let s = createSocketServer();609 s.on('connection', (socket) => {610 socket.write('220 mx.test.com ESMTP\r\n');611 socket.on('data', (data) => {612 socket.write(`500 foo\r\n`);613 });614 });615 await s.start();616 let c = new SMTPClient({port: PORT});617 c._extensions = ['STARTTLS'];618 await c.connect();619 try {620 await c.secure()621 }622 catch(e) {623 t.is(e.message, 'foo');624 }625 await c.close();626 await s.stop();...

Full Screen

Full Screen

search_index.js

Source:search_index.js Github

copy

Full Screen

1var documenterSearchIndex = {"docs": [2{3 "location": "#",4 "page": "Readme",5 "title": "Readme",6 "category": "page",7 "text": ""8},9{10 "location": "#SMTPClient-1",11 "page": "Readme",12 "title": "SMTPClient",13 "category": "section",14 "text": "(Image: Build Status)(Image: SMTPClient)A CURL based SMTP client with fairly low level API. It is useful for sending emails from within Julia code. Depends on LibCURL.jl.SMTPClient requires Julia 0.7 or higher."15},16{17 "location": "#Installation-1",18 "page": "Readme",19 "title": "Installation",20 "category": "section",21 "text": "Pkg.add(\"SMTPClient\")The libCurl native library must be available. It is usually installed with the base system in most Unix variants."22},23{24 "location": "#Usage-1",25 "page": "Readme",26 "title": "Usage",27 "category": "section",28 "text": "using SMTPClient\n\nopt = SendOptions(\n isSSL = true,\n username = \"you@gmail.com\",\n passwd = \"yourgmailpassword\")\n#Provide the message body as RFC5322 within an IO\nbody = IOBuffer(\n \"Date: Fri, 18 Oct 2013 21:44:29 +0100\\n\" *\n \"From: You <you@gmail.com>\\n\" *\n \"To: me@test.com\\n\" *\n \"Subject: Julia Test\\n\" *\n \"\\n\" *\n \"Test Message\\n\")\nurl = \"smtps://smtp.gmail.com:465\"\nrcpt = [\"<me@test.com>\", \"<foo@test.com>\"]\nfrom = \"<you@gmail.com>\"\nresp = send(url, rcpt, from, body, opt)Sending from file IOStream is supported:\nbody = open(\"/path/to/mail\")"29},30{31 "location": "#Gmail-Notes-1",32 "page": "Readme",33 "title": "Gmail Notes",34 "category": "section",35 "text": "Due to the security policy of Gmail, you need to \"allow less secure apps into your account\":https://myaccount.google.com/lesssecureapps"36},37{38 "location": "#Function-Reference-1",39 "page": "Readme",40 "title": "Function Reference",41 "category": "section",42 "text": "send(url, to-addresses, from-address, message-body, options)Send an email.url should be of the form smtp://server:port or smtps://....\nto-address is a vector of String.\nfrom-address is a String. All addresses must be enclosed in angle brackets.\nmessage-body must be a RFC5322 formatted message body provided via an IO.\noptions is an object of type SendOptions. It contains authentication information, as well as the option of whether the server requires TLS.SendOptions(; isSSL = false, verbose = false, username = \"\", passwd = \"\")Options are passed via the SendOptions constructor that takes keyword arguments. The defaults are shown above.verbose: enable libcurl verbose mode or not.\nIf the username is blank, the passwd is not sent even if present.Note that no keepalive is implemented. New connections to the SMTP server are created for each message."43},44{45 "location": "autodocs/#",46 "page": "Docstrings",47 "title": "Docstrings",48 "category": "page",49 "text": "SMTPClient.@ce_curlSMTPClient.@ce_curlmSMTPClient.ConnContextSMTPClient.ReadDataSMTPClient.SMTPClientSMTPClient.SendOptionsSMTPClient.SendResponseSMTPClient.__init__SMTPClient.c_curl_read_cbSMTPClient.c_curl_write_cbSMTPClient.cleanup!SMTPClient.connectSMTPClient.curl_read_cbSMTPClient.curl_write_cbSMTPClient.do_sendSMTPClient.evalSMTPClient.getresponse!SMTPClient.includeSMTPClient.sendSMTPClient.setmail_from!SMTPClient.setmail_rcpt!SMTPClient.setopt!SMTPClient.writeptr"50},...

Full Screen

Full Screen

worker-config.js

Source:worker-config.js Github

copy

Full Screen

1/*global require, setTimeout */2// Note: No AMD module here since this file configures RequireJS.3(function(root) {4 'use strict';5 requirejs.config({6 baseUrl: '.',7 packages: [{8 name: 'wo-imap-handler',9 location: 'ext/imap-handler/src',10 main: 'imap-handler'11 }],12 map: {13 'browserbox': {14 'axe': 'axeshim-browserbox'15 },16 'browserbox-imap': {17 'axe': 'axeshim-browserbox'18 },19 'ext/smtpclient': {20 'axe': 'axeshim-smtpclient'21 },22 },23 paths: {24 // Configure any manual paths here:25 'bleach': 'ext/bleach.js/lib/bleach',26 'imap-formal-syntax': 'ext/imap-handler/src/imap-formal-syntax',27 'smtpclient-response-parser':28 'ext/smtpclient/src/smtpclient-response-parser',29 'tests': '../test/unit',30 'wbxml': 'ext/activesync-lib/wbxml/wbxml',31 'activesync/codepages': 'ext/activesync-lib/codepages',32 'activesync/protocol': 'ext/activesync-lib/protocol',33 // This lists every top-level module in GELAM/js/ext.34 // CAUTION: It is automatically updated during the build step;35 // don't change or your edits will be as sticky as a dusty post-it.36 // If you see changes here because you modified our deps, commit it!37 // <gelam-ext>38 'activesync-lib': 'ext/activesync-lib',39 'addressparser': 'ext/addressparser',40 'alameda': 'ext/alameda',41 'axe': 'ext/axe',42 'axe-logger': 'ext/axe-logger',43 'axeshim-browserbox': 'ext/axeshim-browserbox',44 'axeshim-smtpclient': 'ext/axeshim-smtpclient',45 'bleach.js': 'ext/bleach.js',46 'browserbox': 'ext/browserbox',47 'browserbox-imap': 'ext/browserbox-imap',48 'evt': 'ext/evt',49 'imap-handler': 'ext/imap-handler',50 'mailbuild': 'ext/mailbuild',51 'md5': 'ext/md5',52 'mimefuncs': 'ext/mimefuncs',53 'mimeparser': 'ext/mimeparser',54 'mimeparser-tzabbr': 'ext/mimeparser-tzabbr',55 'mimetypes': 'ext/mimetypes',56 'mix': 'ext/mix',57 'punycode': 'ext/punycode',58 'rdcommon': 'ext/rdcommon',59 'safe-base64': 'ext/safe-base64',60 'smtpclient': 'ext/smtpclient',61 'stringencoding': 'ext/stringencoding',62 'tcp-socket': 'ext/tcp-socket',63 'utf7': 'ext/utf7',64 'wmsy': 'ext/wmsy',65 'wo-utf7': 'ext/wo-utf7'66 // </gelam-ext>67 },68 // Timeouts are mostly to detect 404 errors, however, there are erorrs69 // generated in the logs in those cases, so the main concern is slow70 // devices taking a while/email app competing with other apps for time,71 // so set this to zero always.72 waitSeconds: 073 });74 // Allow baseUrl override for things like tests75 if (typeof gelamWorkerBaseUrl === 'string') {76 requirejs.config({77 baseUrl: gelamWorkerBaseUrl78 });79 }80 // Install super-simple shims here.81 root.setZeroTimeout = function(fn) {82 setTimeout(function() { fn(); }, 0);83 };...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var smtp = require('smtp-protocol');2var client = smtp.connect(2525);3client.helo('localhost').then(function () {4 return client.mail('from@localhost');5}).then(function () {6 return client.rcpt('to@localhost');7}).then(function () {8 return client.data('Hello world!');9}).then(function () {10 return client.quit();11});12var smtp = require('smtp-protocol');13var client = smtp.connect(2525);14client.helo('localhost').then(function () {15 return client.mail('from@localhost');16}).then(function () {17 return client.rcpt('to@localhost');18}).then(function () {19 return client.data('Hello world!');20}).then(function () {21 return client.quit();22});23var smtp = require('smtp-protocol');24var client = smtp.connect(2525);25client.helo('localhost').then(function () {26 return client.mail('from@localhost');27}).then(function () {28 return client.rcpt('to@localhost');29}).then(function () {30 return client.data('Hello world!');31}).then(function () {32 return client.quit();33});34var smtp = require('smtp-protocol');35var client = smtp.connect(2525);36client.helo('localhost').then(function () {37 return client.mail('from@localhost');38}).then(function () {39 return client.rcpt('to@localhost');40}).then(function () {41 return client.data('Hello world!');42}).then(function () {43 return client.quit();44});45var smtp = require('smtp-protocol');46var client = smtp.connect(2525);47client.helo('localhost').then(function () {48 return client.mail('from@localhost');49}).then(function () {50 return client.rcpt('to@localhost');51}).then(function () {52 return client.data('Hello world!');53}).then(function () {54 return client.quit();55});56var smtp = require('smtp-protocol');57var client = smtp.connect(2525);58client.helo('localhost').then(function () {

Full Screen

Using AI Code Generation

copy

Full Screen

1var smtp = require('smtp-protocol'),2 net = require('net'),3 fs = require('fs'),4 crypto = require('crypto');5var server = net.createServer(function (socket) {6 var client = smtp(socket);7 client.on('greeting', function (greeting, session, callback) {8 console.log('greeting', greeting);9 callback(null, 'localhost');10 });11 client.on('startData', function (session, callback) {12 console.log('startData', session);13 callback(null, true);14 });15 client.on('data', function (chunk, session, callback) {16 console.log('data', session);17 callback(null, chunk.length);18 });19 client.on('dataReady', function (session, callback) {20 console.log('dataReady', session);21 callback(null, true);22 });23 client.on('message', function (session, callback) {24 console.log('message', session);25 callback(null, true);26 });27});28server.listen(2525);29var smtp = require('smtp-protocol'),30 net = require('net'),31 fs = require('fs'),32 crypto = require('crypto');33var server = net.createServer(function (socket) {34 var client = smtp(socket);35 client.on('greeting', function (greeting, session, callback) {36 console.log('greeting', greeting);37 callback(null, 'localhost');38 });39 client.on('startData', function (session, callback) {40 console.log('startData', session);41 callback(null, true);42 });43 client.on('data', function (chunk, session, callback) {44 console.log('data', session);45 callback(null, chunk.length);46 });47 client.on('dataReady', function (session, callback) {48 console.log('dataReady', session);49 callback(null, true);50 });51 client.on('message', function (session, callback) {52 console.log('message', session);53 callback(null, true);54 });55});56server.listen(2525);57var smtp = require('smtp-protocol'),58 net = require('net'),59 fs = require('fs'),60 crypto = require('crypto');61var server = net.createServer(function (socket

Full Screen

Using AI Code Generation

copy

Full Screen

1var assert = require('assert'),2 smtpClient = require('mountebank').smtpClient,3 Q = require('q'),4 fs = require('fs'),5 client = smtpClient({6 });7Q.ninvoke(client, 'send', {8})9.then(function () {10 return Q.ninvoke(client, 'close');11})12.then(function () {13 console.log('Email sent');14})15.fail(function (error) {16 console.error(error);17 process.exit(1);18});19var assert = require('assert'),20 mb = require('mountebank'),21 Q = require('q'),22 fs = require('fs'),23 client = mb.createClient({24 });25Q.ninvoke(client, 'get', '/imposters')26.then(function (response) {27 return Q.ninvoke(client, 'get', '/imposters/' + response.body[0].port);28})29.then(function (response) {30 var request = response.body.requests[0];31 assert.strictEqual(request.method, 'POST');32 assert.strictEqual(request.path, '/');33 assert.strictEqual(request.query.from, 'test@localhost');34 assert.strictEqual(request.query.to, 'test@localhost');35 assert.strictEqual(request.query.subject, 'Test email');36 assert.strictEqual(request.query.text, 'This is a test email');37 console.log('Email verified');38})39.fail(function (error) {40 console.error(error);41 process.exit(1);42});

Full Screen

Using AI Code Generation

copy

Full Screen

1var smtp = require('smtp-protocol');2var server = smtp.createServer(function(req) {3 req.accept();4});5server.listen(2525);6var smtp = require('smtp-protocol');7var server = smtp.createServer(function(req) {8 req.accept();9});10server.listen(2525);11var smtp = require('smtp-protocol');12var server = smtp.createServer(function(req) {13 req.accept();14});15server.listen(2525);16var smtp = require('smtp-protocol');17var server = smtp.createServer(function(req) {18 req.accept();19});20server.listen(2525);21var smtp = require('smtp-protocol');22var server = smtp.createServer(function(req) {23 req.accept();24});25server.listen(2525);26var smtp = require('smtp-protocol');27var server = smtp.createServer(function(req) {28 req.accept();29});30server.listen(2525);31var smtp = require('smtp-protocol');32var server = smtp.createServer(function(req) {33 req.accept();34});35server.listen(2525);36var smtp = require('smtp-protocol');37var server = smtp.createServer(function(req) {38 req.accept();39});40server.listen(2525);

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run mountebank automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful