PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WEBDEV 2024 → Email Attachment in Stored Procedure
Email Attachment in Stored Procedure
Débuté par Kanwal, 13 jan. 2014 12:40 - Aucune réponse
Posté le 13 janvier 2014 - 12:40
Hello Seniors,

I am trying to send an image as a attachment with email via WebDev 17 Stored Procedures.
If i do the same from a button on page, my codes work just fine and i receive an email with the attachment whereas if the same code is used in the stored procedures then size of the attached image shows 0kb.

mysession is EmailSMTPSession
mysession..ServerAddress="smtp.gmail.com"
mysession..Port=587
mysession..Name="test123@gmail.com"
mysession..Password="test123"
mysession..Option=emailOptionSecuredTLS

myMessage is Email
myMessage..Sender="test123@gmail.com"
myMessage..SenderAddress="test123@gmail.com"
myMessage..Subject="Birthday Mail"
myMessage..HTML=[
<html><body>Test Email</body></html>
]
myAttach is EmailAttach

// Build the EmailAttach variable
myAttach..Name="MyImg"
myAttach..Content=fLoadText("D:\Purple.jpg")
myAttach..ContentType="application/jpeg"
myAttach..ContentDescription="An image"

// Add the attachment
Add(myMessage..Attach,myAttach)
myMessage..Recipient[1]=""test@gmail.com""

IF EmailStartSession(mysession)=True THEN
IF EmailSendMessage(mysession,myMessage)=False THEN

EmailCloseSession(mysession)

ELSE
EmailCloseSession(mysession)

END
END

Can an image be attached in an email in stored Procedures?
I have attached .doc files in emails with stored procedures earlier and they work fine.
Please help me out with this one.


Thanks & Regards
Kanwal