Return TypeFunction nameArguments
hzEcodehzEmail::SendEpistula(hzChain&,)

Declared in file: hzMailer.h
Defined in file : hzMailer.cpp

Function Logic:

0:START 1:getpid sprintf hzChain::Printf S ofstream::open ofstream::fail 2:os.fail() 3:Return E_WRITEFAIL 4:items close ofstream::clear hzChain::Clear hzChain::Printf S ofstream::open ofstream::fail 5:os.fail() 6:Return E_WRITEFAIL 7:items hzString::Length 8:m_RealFrom.Length() 9:items 10:items 11:items items items R 12:R.Valid(); 13:hzList::Iter::Element ema hzEmaddr::GetDomain 14:close 15:Return E_OK

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 ;
}