Go to the archive file for emails (one produced each day), and retrieve the email header and body for the given id
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzPop3Acc::GetEmail | (hzEmail&,hzString&,) |
Declared in file: hzMailer.h
Defined in file : hzPop3.cpp
Function Logic:
Function body:
hzEcode hzPop3Acc::GetEmail (hzEmail& theMessage)hzString& mailId,
{
// Go to the archive file for emails (one produced each day), and retrieve the email header and body for the given id
//
// Arguments: 1) em The email instance populated by this operation
// 2) mailId The email unique id
//
// Returns: E_OPENFAIL If the mailbox file could not be opened.
// E_FORMAT If the email is malformed
// E_OK If the email was successfully retrieved from the mailbox
_hzfunc("hzPop3Acc::GetEmail") ;
hzList<hzEmpart>::Iter pi ; // Iterator for the email parts
ifstream is ; // Input stream
hzChain Z ; // For loading message
hzString filepath ; // Full path to email file
hzEcode rc ; // Return code
m_Error.Clear() ;
theMessage.Clear() ;
// Open email file and read in the header. This starts with a line of the form 'From email_addr date' and is followed by lines of
// the form 'param: args'. These lines may be followed by continuation lines that begin with whitespace. We read in continuation
// lines as though they are just extensions to the preceeding parameter line.
filepath = m_Repos + "/" + mailId ;
rc = OpenInputStrm(is, filepath) ;
if (rc != E_OK)
{
hzerr(E_OPENFAIL, "Failed tp open email file %s", *filepath) ;
return E_OPENFAIL ;
}
Z << is ;
is.close() ;
rc = theMessage.Import(Z) ;
return rc ;
}