How to disable a specific email in ActionMailer? - ruby-on-rails-3

I would like to disable only certain emails.
I have a mailer class that has a method which is used to send the emails. I cannot get rid of the method itself as it is called from several places. I would like to change the method in such a way that the calls to the method doesn't actually send any email.

You could throw this in your method or use it where you call deliver on the email that you do not want to send in production
unless Rails.env.production?
EDIT
If you just want to check the class of the call
if self.is_a?(class)

Related

Changing the email text in an "have server reply using specific reply" action with vba

I have the following rule in outlook:
have server reply using specific reply rule
My aim is now, to change the email text that gets send by the action with a vba script. The data we send out as a respones changes daily, so at the moment we have to change it by hand. I tried now many things, but don't come really to the possibility to change the text with vba.
I'm also not sure if i can get it with olRuleActionServerReply (because it has no item oder similar when i watch this action) or with olRuleActionTemplate...
I'm happy for any hint in this situation. Thank you in advance!
I tried to find anything in the documentation but didn't find anything helpful.
There is no way to use a dynamic reply with a different text used for the message body. You need to set up a different rule for that or handle incoming emails in VBA without rules involved.
For example, you could handle the NewMailEx event of the Application class where you could check the incoming email and prepare the response and send it automatically. This event fires once for every received item that is processed by Microsoft Outlook. The item can be one of several different item types, for example, MailItem, MeetingItem, or SharingItem. The EntryIDsCollection string contains the Entry ID that corresponds to that item. Use the Entry ID to call the NameSpace.GetItemFromID method and process the item.

Delphi, enhance code of non-virtual methods or events

Although more of a Delphi language question, will use a specific example to try and get the idea across better:
using Delphi's TWebModule for an HTTP server, we can define endpoints as actions, and assign those actions an OnAction event, to execute code when a request is made to this given endpoint.
many, if not most of those actions require authorization: that is, they all start with the same block of code that checks for valid credentials and decides whether to allow the request to execute or not. So I started looking at how one could "group" a set of similar actions into maybe a subclass of the default action class (TWebActionItem) that adds authorization-specific code. One might also want to execute some generic before/after methods.
pseudo-code would look something like this, where TAuthWebActionItem is a subclass of TWebActionItem adding authorization code, and before/after method calls:
function TAuthWebActionItem.OnAction
begin
FBeforeAction // execute some initialization code
if authorized then // auth ok?
inherited // proceed
else
'you are not authorized'
FAfterAction // execute some finalization code
end
we would then create a TAuthWebActionItem, add it to the TWebModule's list of actions, and we're done.
however, the TWebModule and TWebActionItem classes do not offer virtual methods for overriding. Using "reintroduce" instead of "override" would not solve it either, as the TWebModule's actions list items are still of type TWebActionItem: calling the OnAction of a superclass, even if reintroduced, will not execute the subclass' code.
How would one bypass such limitations / constraints in the classes being used, to achieve what's outlined in the pseudo-code above?

Attachments missing on the EWS server for draft email saved via Outlook OfficeJS

I am using the Office.context.mailbox.item.saveAsync method for saving a draft email. This method returns itemId which I later use to make a call to the EWS server to retrieve the email eml content, but the returned eml content is missing some of the attachments.
This is only happening on the Desktop App (Outlook 2013) with cache mode enabled. When using Outlook on the Web it works correctly.
I am using ews-java-api to retrieve the email from the EWS.
Is there a way to know when the email saving is finished?
I can't use the Office.context.mailbox.item.saveAsync.makeEwsRequestAsync because of the 1MB response limitation.
In Cached mode it will take time for the item to sync up to the server. People usually poll until the data they want is there.
Also, they can write a custom property, and check for that property to make sure their item is up to date if necessary.
You can find some details about custom property here: Client Extension Message Object Protocol, Mail App Custom Properties and Mail App Accesses Custom Properties
Is there a way to know when the email saving is finished?
If the following: "Is there a way to know when the email saving is finished?" is your question, than the answer is No. You may try the ugly solution, when you use sub-sequential EWS query with Id you've got from saveAsync in the loop and wait for success. This may take, depend on environment, from a few seconds to like half a minute easily. Not sure if your customers (users) will wait for so long, when add-in finally respond.
You may get more information from the topic: App for Outlook: EWS request failed with item Id returned by item.saveAsync on compose new message
EDIT:
Simple GetItem request can be used as follow ...
<GetItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<ItemShape>
<t:BaseShape>IdOnly</t:BaseShape>
</ItemShape>
<ItemIds><t:ItemId Id="' + itemId + '"/></ItemIds>
</GetItem>
The request should return ChangeKey if item was created on exchange.

Remove BOPF Message (from /bobf/if_frw_message) via ABAP

I got an object with TYPE REF TO /bobf/if_frw_message.
And I need to remove some messages from object before "send it" to UI
Only I know is message class name and message number.
Which is the proper way to deal with it?
As you have noticed the interface only has methods to add and read. The only option you really have here is to use GET( ) to get all the messages, instantiate a new instance of the object and add all the messages one by one using ADD_CM( ) and then skip the one you do not need.
Question is why you need to remove the message. A part of the application wanted to report this, it would be better to suppress it at the point where it gets generated.

AFNetworking get Parameters from Operation

I am attempting to get the parameters for a POST request sent via the AFNetworking pod. However, I can't seem to get them. I am looping through the active operations with the below:
for(AFHTTPRequestOperation* operation in manager.operationQueue.operations){
NSLog(#"%#",operation.request.URL.path);
}
However, I can't get the parameters. I've tried using operation.request.URL.parameterString, but since it is POST, the string is null. Anyone know how to get these? I'd like to collect them so that I can cancel requests that are specific to the path and parameters sent, ensuring I'll get down to just the single request I need to cancel.
I ended up going about this a different way. I created a class that handled all the AFNetworking path calls. In this class is a dictionary which stored an integer id for the call and the operation. As the operations complete or fail, they are removed. The integer id is passed back to the calling object, allowing for unique access for canceling requests or polling.