GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
jwsmtp(3) EMAIL PROGRAMMING jwsmtp(3)

jwsmtp - smtp library in C++

#include <jwsmtp/jwsmtp.h>

mailer(const char* TOaddress, const char* FROMaddress,
       const char* Subject, const std::vector<char>& Message,
       const char* server = "127.0.0.1",
       unsigned short Port = SMTP_PORT,
       bool MXLookup = true);
mailer(const char* TOaddress, const char* FROMaddress,
       const char* Subject, const char* Message,
       const char* server = "127.0.0.1",
       unsigned short Port = SMTP_PORT,
       bool MXLookup = true);
mailer(bool MXLookup = false, unsigned short Port = SMTP_PORT);
void operator()();
void send();
bool attach(const std::string& filename);
bool removeattachment(const std::string& filename);
bool setmessage(const std::string& newmessage);
bool setmessage(const std::vector<char>& newmessage);
bool setmessageHTML(const std::string& newmessage);
bool setmessageHTML(const std::vector<char>& newmessage);
bool setmessageHTMLfile(const std::string& filename);
bool setsubject(const std::string& newSubject);
bool setserver(const std::string& nameserver_or_smtpserver);
bool setsender(const std::string& newsender);
bool addrecipient(const std::string& newrecipient, short recipient_type = TO);
bool removerecipient(const std::string& recipient);
void clearrecipients();
void clearattachments();
void reset();
const static enum {TO, Cc, Bcc, SMTP_PORT = 25, DNS_PORT = 53} consts;	
enum authtype {LOGIN = 1, PLAIN} type;
void authtype(const enum authtype Type);
void username(const std::string& User);
void password(const std::string& Pass);

jwSMTP is a C++ library/code to facilitate sending email programmatically. send in plain text - html format, attachments, multiple recipients - BCC CC included. LOGIN & PLAIN authentication. Do an MX lookup or send direct via smtp server.

Send an email to root on the machine the program is invoked on.
    #include <jwsmtp/jwsmtp.h>
    jwsmtp::mailer m("root", "root", "subject line",
                     "This is the plain text part of the message",
                     "localhost", jwsmtp::mailer::SMTP_PORT, false);
    m.send();
Send an email to someone@somewhere.net from me@myserver.net. Here we do an MX lookup on somewhere.net using the nameserver ns.thenameserver.net
    #include <jwsmtp/jwsmtp.h>
    jwsmtp::mailer m("someone@somewhere.net", "me@myserver.net",
                     "subject line", "Hey what's up?",
                     "ns.thenameserver.net");
    m.send();
Check whether the mail got sent
    if(m.response( ).substr(0,3) != "250") {
        // error, mail not sent
    }

John Wiggins (jw@johnwiggins.net)

June 20, 2004 version 1.32

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.