MCPcopy Create free account
hub / github.com/MailCore/mailcore2 / testAsyncSendMessageFromFileViaSMTP

Function testAsyncSendMessageFromFileViaSMTP

tests/test-all.cpp:355–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

353}
354
355static void testAsyncSendMessageFromFileViaSMTP(mailcore::Data * data)
356{
357 mailcore::SMTPAsyncSession * smtp;
358 TestSMTPCallback * callback = new TestSMTPCallback();
359
360 mailcore::String * filename = temporaryFilenameForTest();
361 data->writeToFile(filename);
362
363 mailcore::Array * recipients;
364 mailcore::Address * from;
365 parseAddressesFromRfc822(filename, &recipients, &from);
366
367 smtp = new mailcore::SMTPAsyncSession();
368
369 smtp->setHostname(MCSTR("smtp.gmail.com"));
370 smtp->setPort(25);
371 smtp->setUsername(email);
372 smtp->setPassword(password);
373 smtp->setConnectionType(mailcore::ConnectionTypeStartTLS);
374
375 mailcore::SMTPOperation * op = smtp->sendMessageOperation(from, recipients, filename);
376 op->setSmtpCallback(callback);
377 op->setCallback(callback);
378 op->start();
379
380 mainLoop();
381
382 //smtp->release();
383}
384
385class TestIMAPCallback : public mailcore::Object, public mailcore::OperationCallback, public mailcore::IMAPOperationCallback {
386 virtual void operationFinished(mailcore::Operation * op)

Callers

nothing calls this directly

Calls 13

temporaryFilenameForTestFunction · 0.85
parseAddressesFromRfc822Function · 0.85
mainLoopFunction · 0.85
setSmtpCallbackMethod · 0.80
writeToFileMethod · 0.45
setHostnameMethod · 0.45
setPortMethod · 0.45
setUsernameMethod · 0.45
setPasswordMethod · 0.45
setConnectionTypeMethod · 0.45
sendMessageOperationMethod · 0.45
setCallbackMethod · 0.45

Tested by

no test coverage detected