RichMail attachment sample

RichMail attachment sample

  

Hello, have you got a sample how use all components of RichMail?

Thanks

Hello Salvador.

What's this "RichMail"? :)
Is a Forge component? (didn't find anyting with this name).
Is it inside another component?
Hope you are not talking about Mail Services... (Development stoped in platform version 5)

Cheers

Obviously rich mail contains the numbers for the next euro million. :D

would it be the send email forge component instead of? 

It's a defaut plugin in the program, you can't add in the mobile project.


Where is the help file that it referer?

Hi,

EDIT:

Never heard of, so I doubt this is a "default" plugin. Also, plugin is a terminology we use most for cordova plugins for mobile, and this does not seem to be one of them. 

In any case, it is a extension, so those are server side actions and you can use only server side only, but it should work calling from server actions in a mobile module.

As this is not a default application in OutSystems, for help and documentation you need to take a look in the Forge app page where this module is (take a look in the app's name in your server). But it is also possible that it is something done in your company and not available in Forge?

Disregard everything above...

Cheers

Hi Eduardo,

I'm sorry, but you're wrong :). RichMail is a system component, and we've been using it for many years. Unfortunately, the help file that comes with it has been corrupted for many years as well, so it's difficult to understand how to use the component.

Back to the original question. Though I haven't got an example lying around, here's what you need to do to make it work:

  1. Call RichMailCreate. You need to fill at least the From, To and Subject parameters, I'd advise to set the Charset to "utf-8", set the Body to the actual mail body (plain text or HTML) and the BodyIsHtml to True if Body contains HTML. The Url parameter, iirc, is only needed if you reference images in the HTML body, we set it to localhost + the eSpace path. InlineImages must be True if you want RichMail to inline images specified in the HTML, otherwise it'll leave image links as-is.
  2. If you want to add an attachment, call RichMailPart. Set the right MIME type in ContentType, Boundery to the output parameter Boundary of RichMailCreate, FileName to the attachment's filename, and Content to the binary content. I'm not sure about Location and TransferEncod, we don't use those. Append the output (Part output parameter) of RichMailPart to the output of RichMailCreate (Mail output parameter). Repeat if you need multiple attachments (don't forget to append the second to the combined output of RichMailCreate and the previous RichMailPart, and so on).
  3. Finally, call RichMailSend to send the e-mail. Specify the e-mail SMTP server in Server, and the content (the output of RichMailCreate or if you have attachments the total content you built) in Mail. I'm not sure how to specify the Identity, we don't use that.

Note that RichMailSend "closes" the e-mail before sending it, so any intermediate output of RichMailCreate / RichMailPart is not a valid e-mail, but you probably needn't worry about that.

Thanks for correcting me, Kilian :) No need to sorry (but I know you aren't haha)

Salvador, I am truly sorry that I provided so wrong answer due not knowing about a system component (what is kind of unforgivable, as it was there in front of me).

Glad Kilian spot the error and corrected me.

Cheers.

Thank you Kilian for your response.Don't work. Have you done a test? I put a screenshot of Action Schema, Is it correct?


And parameters:

Hi Salvador,

Can you provide a bit more information than "don't work"? What exactly doesn't work? Does the mail get sent at all? Or is the attachment not attached? If so, what do you call RichMailSend with?

The email arrives well, but the attachment is not inside.

Hi Salvador,

Did you follow my instructions above? "Append the output (Part output parameter) of RichMailPart to the output of RichMailCreate (Mail output parameter)."

Yes, you can see it in my screenshoot.

sorry Kilian, I did not understand you, how do I do what you said?

Solution

Salvador,

RichMailCreate creates the e-mail without attachments. RichMailPart creates the content for a single attachment. The output of RichMailPart needs to go somewhere! If you supply RichMailSend only the output of RichMailCreate, the attachment isn't sent of course. As both the Mail output of RichMailCreate and the Part output of RichMailPart is just plain text, you just need the + concatenation operator. So in you example above, specifiy

RichMailCreate.Mail + RichMailPart.Part

as input to RichMailSend.


Solution

Works!!! it needs put de Content-Type of RichMailCreate to "multipart/mixed" too.


Thanks for all 

Great to hear you got it to work. We don't set the ContentType, so I think it should work without.

Hi,

Just for future reference, the RichMail extension documentation that Kilian was referring to can be found by opening the extension in Integration Studio.

On the Resources tab, under the Help folder, open the RichMail.chm file:


I opened a recent version and the documentation appears intact but let us know if yours isn't.

And to add to what Ana said above, at least in my situation Windows didn't want to open it from a network drive, and its security settings can't indicate it's blocked because it's downloaded.

Kilian, do you have any example using RichMail to read a mailbox and get an specific ClientId? My question is related to a challenge I have to update a database when the client reads an email. 


So I used the email Extended Properties "Disposition-Notification-To" to notify my mailbox when the user reads the email, and it works fine. Right after the client open the email I receive another email saying that my message sent to Client Name_X on date X. 

Now I need to get this notification email using Outsystems platform so I can update the database saying that read=True where ClientId=X. Is that possible? 


Also, since this will be a test-case, does it work if I create a Google Gmail account just for test purpose and have this Pop3GetMails function retrieving all emails from there, reading and updating the database, then I can use the Pop3DeleteMails to delete them after updated. I just don't know how to set all variables into those functions, like for instance UID. If you have any examples there will be nice! Thanks a lot.