How to set to email from project.properties files - sap-commerce-cloud

I need to trigger two emails for my application, one to logged-in user and one to customer-care.
For the customer care, I am setting the email id in project.properties and then hitting the event class:
deleteAccountSupportEvent.setAgentEmail(agentEmailAddress);
agentEmailAddress is picking email id from project.properties:
final String agentEmailAddress = getConfigurationService().getConfiguration().getString(DELETE_REQUEST_EMAIL_TO_AGENT);
I have set the email in Context class as well :
setAgentEmail(((PHDeleteAccountEmailProcessModel) processModel).getAgentEmail());
But instead of all this, mail is getting triggered to logged-in user.
Please help.

You can keep it simple as follows:
final String agentEmailAddress = getConfigurationService().getConfiguration().getString(DELETE_REQUEST_EMAIL_TO_AGENT);
setAgentEmail(agentEmailAddress);

As far as I know context is used for mail body dynamic content. There might be logic where to email addresses are added.

Related

Does Docusign provide log of changes or an API to view edits during signing?

If I have a TextField that is editable and the signer changes their Title while e-signing, is there a manner in which to monitor TextField edits? Currently I am using the EnvelopesApi.list_audit_events to monitor events. In this case, all I can view is that the signer either 'opened', 'viewed', or 'signed' the envelope. Although that is valuable information, I would also like to know which TextFields the signer edited and what the new values are? Did the signer change their email, title, name, etc? In this particular case I am using TextFields to display email, title, name, etc...
Does the Docusign API provide an avenue for fetching this information? If so, would you please provide a snippet demonstrating how to fetch this info?
You will have to do this by comparing the value that was in these fields before signing to the value you obtain from the envelope after singing.
There's no built-in event that will give you these changes as far as I'm aware, but it can be done using code.
I'm assuming here that what you're doing is setting the values of some text tabs and then want to know if the signer modified them or not. So, yes, you can do that.

How to extract the url from an embedded link in an email

I've got an email processing agent. It copies the body of the email into a document's rich text field. If there are any embedded links in the email I want to process that embedded link and extract the url. I started playing around with MIMEEntity but nothing came of it. Any ideas?
thanks
clem
================
Hi Rich,
Well here's a more robust explanation of what's going on. I have several Notes apps which deal with email correspondence. An email comes in, a Notes document is created with some meta data (system generated ID, user's email, name, company, status, etc). The email body is added to a 'correspondence' rich text field of the created Notes doc. The app allows for someone on our side to follow up on the email (ask a question, provide some feedback, etc). That response from us is pre-pended to the original email. If the original sender responds with some further information, THAT email is also pre-pended. To do this pre-pending, I do
bodyText = EmailDoc.GetFirstItem("Body").text
textFromNotesDoc = CTdoc.GetFirstItem("Issue").text
newTextFromNotesDoc = bodyText + <some stuff> + textFromNotesDoc
I then do a replace.
This worked perfectly fine for years. However, recently users have been sending in emails containing embedded links. Of course anything like that is lost when I do the NotesDocument.GetFirstItem().Text. So I've been trying to think of a way to capture the embedded link. The other day it occurred to me that if I could read the html, I could find and extract the url and simply add it to text. I thought maybe using NotesMIMEEntity would allow me to read through the body field and find the url but that's not working.
Clem
The solution is to NOT NotesDocument.GetFirstItem().Text. Just simply take the email coming in and prepend the body field to the discussion RT field. I add tags to the email going out so that I know if the person responding included the previous conversation. That took a little work to figure out but by using NotesRichTextNavigator and related classes, I'm able to deal with that.
clem

Boolean Tokens in Orchard CMS

Let say I have a Contact Us form in Orchard CMS that I have created that had the following fields
Name:
Email Address:
Message:
Newsletter:
Now upon submitting this form I have it set to email a specific email address and I'm using the Tokens for the four fields to build the email so that the email received might look like this.
Name: John Smith
Email Address: jsmith#example.com
Message: Hi! I love your site and I hope you get some more content that I can use in the future!
Newsletter: True
Now this is fine, but the last field Newsletter is a boolean and I'd like the text represented here to be Yes/No (or potentially other custom words). How do I substitute the default True/False token values in the email for custom ones?
You'll probably need to implement your own token provider for this. Here is an example from the Orchard.Fields module... FieldTokens.cs
Note that there is no direct reference to the Orchard.Tokens project here so they use the event bus convention where you can define your own interface with the same name and signature as another event handler. Orchard will see this convention and treat your implementation as a handler for those events. I only mention this because it confused me at first. You can directly reference the tokens module if you want to.

sharepoint validate custom field

I cave created a custom list in sharepoint (created and provisioned to the 12 hive)
how can i perform validation on certain fields of the list when a new list item is added?
i think i can do it through the "itemadding" event reciever, but is there a more elegant sharepoint way?
eg i just want to check an email field has a valid email format.
I think you have to options. As you have already mentioned using a event receiver would be one way. But I think a more elegant and above all a more SharePoint like way would be implementing your own custom field type and field control.
This will give you the option to validate the mail address before any event receiver is triggered and to react with an validation message to the user giving him the option to correct his input.
You could go with validation on the client using JQuery if you have the id or a css class on the rendered textbox for the email input.

SharePoint publishing site email encoding/decoding

I'm building a SharePoint (MOSS) publishing site for employee information on my company website. I have an employee content type and am using the Contact E-Mail Address site column to store an employee's email address.
Want I'd like is the ability to encode email addresses at runtime to prevent the real email address from being harvested by spammers. This would be decoded when a user clicks the email hyperlink e.g. the following HTML would be sent to the browser:
Email Jonny
I already have the javascript methods for encoding/decoding a text value from the meaningless string above, but am not too sure as to how to approach this with SharePoint in mind. I'm thinking a custom control and/or custom J-Query?
Any help would be much appreciated!
Jonny
In the case that you are unable to put the users into AD, a custom field control will give you the ability to include the custom rendering (jquery) you require as well as the ability to enter the data as "normal" text.
The custom field, once defined "just works" wherever you need to display the field.
Given you are thinking of using JQuery, the issue then becomes one of making sure the jquery library is correctly linked whenever you need to us a field of this type.
If you make those employees members of the site, SharePoint takes care of this issue.
You can send emails to them, but the email address will only be used at send time, when you add a button to email someone, it will not show the email address, its handled at the backend.
SPUtility.SendEmail(SPContext.Current.Web, false, false,
[SPUser.Email][1], "E-mail title",
"E-mail body");
(source: msdn.com)
Two more options/approaches you can try:
(1) implement a custom TextField control, inheriting from Microsoft.SharePoint.WebControls.TextField and override RenderFieldForDisplay
Then in code - encode the field for display.
Add this control to safecontrols and use this in place of the normal TextField in the pagelayout.
(2) use the existing TextField control, but inject a button [Encode] using jQuery next to the TextField in editmode.
Use the JavaScript encode method to encode what the user has typed into an encoded value, replacing the existing TextField value. Which they can then save to into SharePoint.
I'd rate the approaches based on your deployment scenario - Nat's one is the cleanest but probably more involved for deploying, and the jQuery-only one seems very hackish but easy on deployment. The override TextField approach would probably sit somewhere in the middle.

Resources