KSMTP

KSmtp - a job-based API for interacting with SMTP servers

Purpose

This library provides a job-based API for interacting with an SMTP server. Its design follows the design KIMAP.

Description

Sample usage:

void MyClass::login()
{
m_session = new KSmtp::Session("smtp.example.com", 587, KSmtp::Session::StartAndWait, this);
// Start authentication
KSmtp::LoginJob* login = new KSmtp::LoginJob(m_session);
login->setUseTls(true);
login->setUserName("[email protected]");
login->setPassword("password");
connect(login, SIGNAL(result(KJob*)), this, SLOT(loginResult(KJob*)));
login->start();
}
void MyClass::loginResult(KJob* job)
{
if (m_session->state() != KSmtp::Session::Authenticated) {
... // handle error
return;
}
// Create a new KMime::Message
msg->from()->fromUnicodeString("[email protected]", "utf-8");
msg->to()->fromUnicodeString("[email protected]", "utf-8");
msg->subject()->fromUnicodeString("Hi there!", "utf-8");
msg->contentType()->setMimeType("text/plain");
msg->contentTransferEncoding()->setEncoding(KMime::Headers::CEquPr);
// Assembles and encodes the message
msg->assemble();
const QByteArray content = msg->encodedContent(true) + "\r\n";
// Start sending the message
KSmtp::SendJob* send = new KSmtp::SendJob(m_session);
send->setData(content);
send->setSender("[email protected]");
send->setTo("[email protected]");
send->setBcc("[email protected]");
connect(send, SIGNAL(result(KJob*)), SLOT(sendResult(KJob*)));
send->start();
}
Author(s):
The major authors of this library are:
Christophe Laveault <chris[email protected]toph[email protected][email protected][email protected]teri[email protected]nbox.[email protected]com>
Maintainer(s):
Gregory Schlomoff <[email protected][email protected]bett[email protected]erinb[email protected]ox.c[email protected]om>,
License(s):
LGPLv2
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Jul 8 2020 23:08:03 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.