Add an attachment using both a directory path and a filename to name the file.
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzEmail::AddAttachment | (const char*,const char*,hzMimetype,) |
Declared in file: hzMailer.h
Defined in file : hzMailer.cpp
Function Logic:
Function body:
hzEcode hzEmail::AddAttachment (const char* dir)const char* fname, hzMimetype mtype,
{
// Category: Mail Composition
//
// Add an attachment using both a directory path and a filename to name the file.
//
// Arguments: 1) dir Directory
// 2) fname Filename
// 3) mtype MIME type
//
// Returns: E_ARGUMENT If either the directory, filename or MIME type is not supplied
// E_NOTFOUND If the file suggested as an attachment does not exist
// E_OK If the attachment was added
//
_hzfunc("hzEmail::AddAttachment(1)") ;
_efile A ; // Attchement to add
if (!dir || !dir[0])
{
hzerr(E_ARGUMENT, "No directory supplied") ;
return E_ARGUMENT ;
}
if (!fname || !fname[0])
{
hzerr(E_ARGUMENT, "No filename supplied") ;
return E_ARGUMENT ;
}
if (mtype == HMTYPE_INVALID)
{
hzerr(E_ARGUMENT, "Invalid MIME type") ;
return E_ARGUMENT ;
}
A.m_Filepath = dir ;
A.m_Filepath += "/" ;
A.m_Filepath += fname ;
A.m_eType = mtype ;
if (TestFile(*A.m_Filepath) != E_OK)
return E_NOTFOUND ;
return m_SendAttach.Add(A) ;
}