Whenever I try to send an email using an email variable, I get the error "unable to send message without specifying sender".
This problem does not occur when using the email structure, but I need the variable because I need to pass it further around.
This is my current code, in which I clearly specify the sender.
PROCEDURE loc_SendMail()
LOCAL
recipients is array of string
MyEmail is Email
IF NOT EmailStartSMTPSession("HelpdeskSend","","relay.skynet.be") THEN
RESULT Null
END
EDT_Recipient=Replace(EDT_Recipient,";",",")
StringToArray(EDT_Recipient,recipients,",")
FOR EACH sRecip OF recipients
ArrayAdd(MyEmail.Recipient,sRecip)
END
MyEmail.Subject=EDT_Subject
MyEmail.HTML=EDT_Content
FOR EACH ROW OF LOOP_Attachments
EmailLoadAttachment(MyEmail,LOOP_Attachments.ATT_AttPath)
Debug("Added mail attachment: "+LOOP_Attachments.ATT_AttPath)
END
MyEmail..Sender="Helpdesk <helpdesk@domain.com>"
MyEmail..SenderAddress="helpdesk@domain.com"
IF ArrayCount(MyEmail.Recipient)>0 THEN
IF NOT EmailSendMessage("HelpdeskSend",MyEmail,True) THEN
Debug("<WIN_SendMail>"+"Mail kon niet verzonden worden"+ErrorInfo(errFullDetails))
ELSE
Debug("<WIN_SendMail>"+"Mail met succes verzonden")
END
END
EmailCloseSession("ReportSend")
RESULT MyEmail