#ifndef SMTP_INTERFACE_CLASS
#define SMTP_INTERFACE_CLASS

/*****************************************************************************\
*                                                                             *
*  Name   : smtp_interface                                                    *
*  Author : Chris Koeritz                                                     *
*                                                                             *
*******************************************************************************
* Copyright (c) 2006-$now By Author.  This program is free software; you can  *
* redistribute it and/or modify it under the terms of the GNU General Public  *
* License as published by the Free Software Foundation; either version 2 of   *
* the License or (at your option) any later version.  This is online at:      *
*     http://www.fsf.org/copyleft/gpl.html                                    *
* Please send any updates to: fred@gruntose.com                               *
\*****************************************************************************/

//! This class provides a simplified interface for using vmime with SMTP.
/*!
  The vmime library provides extensive support for Mime and email transmission.
  This library simplifies that down into a few key functions we need for
  sending to an SMTP server, possibly with a password or with encryption
  enabled.
*/

#include "dll_mime_email.h"

#include <basis/object_base.h>

// forward.
class istring;
class string_array;

class MIME_EMAIL_CLASS_STYLE smtp_interface
{
public:
  smtp_interface();
  virtual ~smtp_interface();

  IMPLEMENT_CLASS_NAME("smtp_interface");

  void setup_session(const istring &server_name, int smtp_port,
          const istring &user_name = istring::empty_string(),
          const istring &password = istring::empty_string());
  void set_server(const istring &server_name);
  void set_port(int smtp_port);
  void set_auth_user(const istring &user_name);
  void set_auth_password(const istring &password);

  void setup_message(const istring &sender_email, const istring &subject,
          const istring &message_body);
  void set_sender(const istring &sender_email);
  void set_subject(const istring &subject);
  void set_body(const istring &message_body);

  void add_attachment(const istring &filename);
  void remove_attachment(const istring &filename);
  void clear_attachments();

void simple_test();

private:
  istring *_sess_server;
  int _sess_port;
  istring *_sess_user;
  istring *_sess_password;
  istring *_msg_sender;
  istring *_msg_subject;
  istring *_msg_body;
  string_array *_attachments;
};

#endif

