Email body per form query

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Email body per form query

Eusebio
Hi,

I've read a few posts about building different email bodies including form data and that has given me a good idea of what needs to be done. What we are trying to do is probably a bit more simple and I would just like to determine the best approach.

For each form we would like to have a custom email body, it doesn't need to contain any form data, just be different for each form.

I see two potential ways to approach this since it can't be put into the properties-local.xml like other email options, i.e. subject or sender.

1. We could amend the 'email-form.xpl' and the 'resources.xml' to determine via a variable the form name and then use a specific email-body from 'resources.xml' based on the form name.

2. We could direct the forms to use specific versions of 'email-form.xpl' and 'resources.xml', something like 'email-formA.xpl' and 'resourcesA.xml' which would essentially be replicas of the originals just with the changes we need.

I was hoping to find this information - http://wiki.orbeon.com/forms/doc/developer-guide/admin/overriding-adding-resources but the link is now broken so I suspect the method may have changed?

Any pointers as to which method would be best would be great.

Thanks

Eusebio
Reply | Threaded
Open this post in threaded view
|

Re: Email body per form query

Erik Bruchez
Administrator
Eusebio,

If the text is static per form definition you can simply override the resource in the properties:

    <property as="xs:string" name="oxf.fr.resource.app1.form1.en.email.body">
        This is the body form app1/form1.
    </property>
   
    <property as="xs:string" name="oxf.fr.resource.app1.form2.en.email.body">
        This is the body form app1/form2.
    </property>

Would this work for you?

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: Email body per form query

Eusebio
Hi,

Yes that will be perfect for now for some reason I thought this had been removed as it was in the old documentation but not in the new.

Long term we would want different emails going to different people:-

- Submitter
- Moderator
- Form owner

However this might be better suited to an API call based on hidden fields or something on time of submission. Various email gateways have REST APIs. It would be interesting to know if anyone else has experience doing this.

For now I will test the email body in properties.

Thanks,

Eusebio
Reply | Threaded
Open this post in threaded view
|

Re: Email body per form query

Eusebio
One more thing.

Could you use HTML here?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Email body per form query

Erik Bruchez
Administrator
In reply to this post by Eusebio
Eusebio,

Got it. We have to related RFEs:

    https://github.com/orbeon/orbeon-forms/issues/2428

and:

    https://github.com/orbeon/orbeon-forms/issues/2501

Both make a lot of sense.

-Erik