James, thanks to your help I found what the problem was: it works fine if you use FROM USER clause but no if you remove it. Without FROM USER clause the image seems not to be embedded.
Can you try it there?
EMG
James, thanks to your help I found what the problem was: it works fine if you use FROM USER clause but no if you remove it. Without FROM USER clause the image seems not to be embedded.
Can you try it there?
EMG
Enrico,
Yes, I confirm that if you don't use the FROM USER clause, the image is not included, only the link. This seems to be a bug in OE.
I found that there is a setting under Tools, Options, Send tab, Mail Sending Format, HTML Settings button, that has a checkbox "Send Pictures with messages" and it is checked. However, this seems to be being ignored when sending without user interaction.
James
Ok, thank you.
EMG
PROCEDURE SendEmail( cTo, cSubject, cBody, aFiles_with_path, aFiles_only_name, lPause )
LOCAL i, oMail, aFiles
DEFAULT lPause:=.T.
//Second SendEmail option.
// local cSubject, cBody, aTo, aFiles
DEFINE MAIL oMail SUBJECT cSubject ;
TEXT cBody ;
TO cTo ;
FROM USER
aFiles:={}
FOR i:= 1 TO Len(aFiles_with_path)
IF FILE(aFiles_with_path[i])
AADD(aFiles,{aFiles_with_path[i],aFiles_only_name[i]})
ELSE
MSGINFO(aFiles_only_name[i]+" File not found: "+aFiles_with_path[i],"Email")
ENDIF
NEXT
IF LEN(aFiles)>0
oMail:aFiles := aFiles //{{DEFPATH() + "..\Error.log","testError.txt"},{DEFPATH() + "..\Error.log","t2estError.log"}}//aFilenames
ENDIF
oMail:lFromUser := lPause
ACTIVATE MAIL oMail
IF oMail:nRetCode!=0
IF oMail:nRetCode=1
MSGALERT("Email Cancelled","Email")
ELSE
MsgAlert("The message was not sent."+CRLF+CRLF+;
"MAPI Error code: "+ltrim(str(oMail:nRetCode))+" : "+MAPI_ERROR(oMail:nRetCode),"Error")
ENDIF
ENDIF
RETURN
STATIC FUNCTION MAPI_ERROR(nErrorCode)
LOCAL cResult
LOCAL aError:={"MAPI_USER_ABORT",; //1
"MAPI_E_FAILURE",; //2
"MAPI_E_LOGIN_FAILURE",; //3
"MAPI_E_DISK_FULL",; //4
"MAPI_E_INSUFFICIENT_MEMORY",; //5
"MAPI_E_ACCESS_DENIED",; //6
"UNKNOWN ERROR",; //7
"MAPI_E_TOO_MANY_SESSIONS",; //8
"MAPI_E_TOO_MANY_FILES",; // 9
"MAPI_E_TOO_MANY_RECIPIENTS",; // 10
"MAPI_E_ATTACHMENT_NOT_FOUND",; // 11
"MAPI_E_ATTACHMENT_OPEN_FAILURE",; // 12
"MAPI_E_ATTACHMENT_WRITE_FAILURE",; // 13
"MAPI_E_UNKNOWN_RECIPIENT",; // 14
"MAPI_E_BAD_RECIPTYPE",; // 15
"MAPI_E_NO_MESSAGES",; // 16
"MAPI_E_INVALID_MESSAGE",; // 17
"MAPI_E_TEXT_TOO_LARGE",; // 18
"MAPI_E_INVALID_SESSION",; // 19
"MAPI_E_TYPE_NOT_SUPPORTED",; // 20
"MAPI_E_AMBIGUOUS_RECIPIENT",; // 21
"MAPI_E_MESSAGE_IN_USE",; // 22
"MAPI_E_NETWORK_FAILURE",; // 23
"MAPI_E_INVALID_EDITFIELDS",; // 24
"MAPI_E_INVALID_RECIPS",; // 25
"MAPI_E_NOT_SUPPORTED"} // 26
IF nErrorCode>26.OR.nErrorCode<1
cResult:= "UNKNOWN ERROR"
ELSE
cResult:=aError[nErrorCode]
ENDIF
RETURN (cResult)