Jump to content
Fivewin Brasil

Enviar email


edutraini

Recommended Posts

Tenho uma rotina que envia email e nesse email tem 4 anexos e as vezes uma variável não tem nenhum anexo ou seja fica em branco

ai o Outlook não abre


Alguem poderia me dar alguma dica de como fazer




DEFINE MAIL oMAIL ;

SUBJECT "Nota Fiscal Eletrônica "; // assunto

TO nEmail ; // para

TEXT nMeuIP ; //mensagem

FILES nArq,"",nArq1,"",nArq3,"",nArq4,"" FROM USER

SEND MAIL oMAIL

Link to comment
Share on other sites


#Include "FiveWin.ch"
#Include "Mail.ch"

FUNCTION Main()

LOCAL MailTo, cSndFile, cSndFile2, cText, cSubj

// Campo Para:
MailTo := "joao@pleno.com.br"

// Arquivo a Anexar
cSndFile := "C:\FWH1306\SAMPLES\VoNfeUtil2G.Log"
cSndFile2 := "C:\FWH1306\SAMPLES\ERROR.Log"

// Texto do Corpo do Email
cText := "Favor Verificar Erros da Nota Fiscal Eletrônica - Arquivo Anexo"

// Titulo do Email
cSubj := "Erros da Nota Fiscal Eletrônica"

//LogOn in the mail system
MAPILogOn()

// Abre o OutLook Express ou o Windows Live Mail - Tem que estar padrao
SendMail2( MailTo, cSndFile, cSndFile2, cText, cSubj )

// LogOff from the mail system
MAPILogOff()

RETURN NIL

// Envia o arquivo de erro do programa

FUNCTION SendMail2( MailTo, cSndFile, cSndFile2, cText, cSubj )

LOCAL oMail

DEFINE MAIL oMail ;
SUBJECT cSubj ;
TEXT cText ;
FILES cSndFile, cSndFile, cSndFile2, cSndFile2 ;
FROM USER ;
TO MailTo

ACTIVATE MAIL oMail

IF ( oMail:nRetCode ) = 0

// MsgInfo( "Mensagem Enviada com Sucesso", "Aviso" )
// nada a fazer

ELSE

MsgInfo( OemToAnsi( "NÆo Foi Possivel Enviar a Mensagem de Erro" )+CRLF+;
OemToAnsi( "Por Favor Verifique se o Enviador de Email" )+CRLF+;
OemToAnsi( "OutLook Express ou Windows Live Mail, " )+CRLF+;
OemToAnsi( "Est Definido Como Enviador PadrÆo, nas " )+CRLF+;
OemToAnsi( "Op‡äes da Internet - Internet Explorer. " ), ;
OemToAnsi( "NÆo Foi Possivel Enviar a Mensagem de Erro" ) )

ENDIF

RETURN( .T. )

/*
MAPI Mail Syntax:

DEFINE MAIL [ <oMail> ];
[ SUBJECT <cSubject> ];
[ TEXT <cText> ];
[ TYPE <cType> ];
[ DATE <dDate> ];
[ TIME <cTime> ];
[ CONVERSATION <cConversation> ]:
[ RECEIPT ];
[ FROM USER ];
[ FILES <cFilename1> ,<cDescript1>, <cFilenameN>, <cDescriptN> ] ];
[ ORIGIN <cOrigin> [ <cOriginAddress> ] ];
[ TO <cTarget1>, [ <cTargetAddress1> ] [ <cTargetN> [ <cTargetAddressN> ] ] ];

DEFINE MAIL...FILES cFilename1,,cFilename2,,Filename3

/*
DEFINE MAIL oMail ;
SUBJECT cxSUBJECT ;
FILES cRutafileA , cRutafileA , cRutafileB , cRutafileB ;
TEXT cTexto ;
TO cEmail, cEmail
ACTIVATE MAIL oMail
*/

*/

// FIM DO PROGRAMA


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...