/usr/include/sipxtapi/net/MailMessage.h is in libsipxtapi-dev 3.3.0~test17-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | //
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////
//Example:
/*
MailMessage message("XXX",
"XXX@pingtel.com",
"XXX.pingtel.com");
message.Body("this is a test message");
message.Subject("Hello World!");
message.To("XXX","XXX@pingtel.com");
message.Send();
*/
// MailMessage class declaration for Mailer
#ifndef __MAILMESSAGE_H__
#define __MAILMESSAGE_H__
#include "os/OsDefs.h"
#include "MailAttachment.h"
#include <vector>
using namespace std;
class MailMessage
{
public:
MailMessage(const UtlString &rFromName,
const UtlString &rFromAddress,
const UtlString &rSmtpServer)
{
UtlString fromName = rFromName.data();
m_From.Name = fromName.data();
UtlString fromAddress = rFromAddress.data();
m_From.Address = fromAddress;
UtlString smtpServer = rSmtpServer.data();
m_Server = smtpServer;
}
void To(const UtlString &rName, const UtlString &rAddress)
{
UtlString name = rName.data();
UtlString address = rAddress.data();
m_vecTo.push_back(MailAddress(name,address));
}
void Cc(const UtlString &rName, const UtlString &rAddress)
{
UtlString name = rName.data();
UtlString address = rAddress.data();
m_vecCc.push_back(MailAddress(name,address));
}
void Bcc(const UtlString &rName, const UtlString &rAddress)
{
UtlString name = rName.data();
UtlString address = rAddress.data();
m_vecBcc.push_back(MailAddress(name,address));
}
void Subject(const UtlString &rSubject)
{
UtlString subject = rSubject.data();
m_Subject = subject;
}
void Body(const UtlString &rText);
void Body(const UtlString &rText, const UtlString &rHtml);
bool Attach(const UtlString &rFilename);
bool Attach(const unsigned char *data, const int& rDatalength, const UtlString &rFilename );
// Send the message to the SMTP server specified in the constructor.
// Return either "" or an error message.
UtlString Send();
private:
UtlString FormatForSending();
struct MailAddress
{
MailAddress() {;}
MailAddress(const UtlString &name, const UtlString &address)
{ Name=name; Address=address; }
UtlString toString() const
{
UtlString str = "\"";
str += Name;
str += "\" <";
str += Address;
str += ">";
return str;
}
UtlString Name;
UtlString Address;
};
MailAddress m_From;
vector<MailAddress> m_vecTo;
vector<MailAddress> m_vecCc;
vector<MailAddress> m_vecBcc;
UtlString m_Subject;
UtlString m_ContentType;
UtlString m_Body;
vector<MailAttachment> m_vecAttachment;
UtlString m_Server;
};
#endif
|