| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzEmail::SendEpistula | (hzChain&,) |
Declared in file: hzMailer.h
Defined in file : hzMailer.cpp
Function Logic:
Function body:
hzEcode hzEmail::SendEpistula (hzChain& report)
{
_hzfunc("hzEmail::SendEpistula") ;
static uint32_t nSeq = 1000;
hzList<hzEmaddr>::Iter R ;
ofstream os ;
hzChain Z ;
hzString S ;
hzEmaddr ema ;
char cvId[12];
sprintf(cvId, "%04x.%04x", getpid(), ++nSeq) ;
Z.Printf("/usr/epistula/mailque/%s_body", cvId) ;
S = Z ;
os.open(*S) ;
if (os.fail())
{
hzerr(E_WRITEFAIL, "Cannot open mail item file (%s) for writing", *S) ;
return E_WRITEFAIL ;
}
os << m_Final ;
os.close() ;
os.clear() ;
Z.Clear() ;
Z.Printf("/usr/epistula/mailque/%s_head", cvId) ;
S = Z ;
os.open(*S) ;
if (os.fail())
{
hzerr(E_WRITEFAIL, "Cannot open mail item file (%s) for writing", *S) ;
return E_WRITEFAIL ;
}
os << "from : " << m_AddrFrom << "\r\n" ;
if (m_RealFrom.Length())
os << "announce : " << m_RealFrom << "\r\n" ;
else
os << "announce : " << m_AddrFrom << "\r\n" ;
os << "ip_addr : " << "127.0.0.1" << "\r\n" ;
os << "resolved : " << m_AddrFrom << "\r\n" ;
os << "mail_id : " << cvId << "\r\n" ;
for (R = m_Recipients ; R.Valid() ; R++)
{
ema = R.Element() ;
os << "relay_to : " << ema.GetDomain() << "\r\n" ;
}
os.close() ;
return E_OK ;
}