User Function mail008()
Local oMail := TMailManager():New()
Local nRet := 0
oMail:Init( "", EMAIL_SMTPSERVER, EMAIL_ACCOUNT, EMAIL_PASSWORD )
nret := oMail:SetSMTPTimeout( 60 ) //1 min
If nRet == 0
conout( "SetSMTPTimeout Successful" )
Else
conout( nret )
conout( oMail:GetErrorString( nret ) )
Endif
nret := oMail:SMTPConnect()
If nRet == 0
conout( "Connect Successful" )
Else
conout( nret )
conout( oMail:GetErrorString( nret ) )
Endif
nRet := oMail:SendMail( "[email protected]", ;
"[email protected]", ;
"SUBJECT", ;
"BODY", ;
"", ;
"", ;
{}, ;
0 )
If nRet == 0
conout( "SendMail Successful" )
Else
conout( nret )
conout( oMail:GetErrorString( nret ) )
Endif
nRet := oMail:SmtpDisconnect()
If nRet == 0
conout( "Disconnect Successful" )
Else
conout( nret )
conout( oMail:GetErrorString( nret ) )
Endif
return |