email with CDO and attachment
Posted: Fri May 04, 2018 12:43 pm
Hello,
I have problems when I try to add attachment to email, the follow sample work when I comment the attachment line
I get
I try :attachments:add("file"), :attachment := "file" and other alternatives, but I can't get that it work, I 'm testing in win10
Some help
Regards
Marcelo
I have problems when I try to add attachment to email, the follow sample work when I comment the attachment line
Code: Select all
#include "fivewin.ch"
function main()
LOCAL oEmailMsg
LOCAL cSchema := "http://schemas.microsoft.com/cdo/configuration/"
oEmailMsg := CREATEOBJECT ( "CDO.Message" )
WITH OBJECT oEmailMsg
:From := "email@gmail.com"
:To := "email@gmail.com"
:CC := ""
:BCC := ""
:Subject := ALLTRIM( "ALGO" )
:TextBody := "CUERPITO"
:AddAttachment( ALLTRIM( "email.prg" ) ) // <------ error aqui
WITH OBJECT :configuration:Fields
:Item( cSchema + "smtpserver" ):Value := "smtp.gmail.com"
:Item( cSchema + "smtpserverport" ):Value := 465
:Item( cSchema + "sendusing" ):Value := 2
:Item( cSchema + "smtpauthenticate" ):Value := .T.
:Item( cSchema + "smtpusessl" ):Value := .T.
:Item( cSchema + "sendusername" ):Value := "email@gmail.com"
:Item( cSchema + "sendpassword" ):Value := "somepassword"
:Item( cSchema + "smtpconnectiontimeout"):Value := 30
:Update()
END WITH
:Send()
END WITH
RETURN NIL
Code: Select all
Time from start: 0 hours 0 mins 0 secs
Error occurred at: 05/04/18, 08:39:19
Error description: Error CDO.Message/3 DISP_E_MEMBERNOTFOUND: ADDATTACHMENT
Some help
Regards
Marcelo