Microsoft Outlook Message When Emailing in Progress Application - progress-4gl

There is a below code, does not work
FOR EACH customer where customer.contactmethod = 'E':
MESSAGE "EMAILING TO" customer.customerCode customer.CustomerName.
RUN Emaling.p (INPUT parameter 1,INPUT pramater 2 ....)
END.
When this above loop executes it, it messages the first customer only. The reason I found is the outlook message.
The Outlook message is below
"A program is trying to send an email message on your behalf. if this is unexpected, clikc Deny and verify your antivirus software is upto date......................................."
if user click allow/deny in the outlook message, it does not message the second customer as it is stuck in first customer.
How can I suppress this outlook message using 4gl code?

The key to that is inside your "Emaling.p" procedure. Whatever technique that code is using to send email needs to be adjusted to bypass the security check.
Or you could disable whatever it is that is popping up that message. It looks like some over-zealous Windows security setting.
In any case it has nothing much to do with the 4gl code that you have shown.
Having said that -- your code is obviously incomplete and as shown would not be expected to work at all. Maybe it doesn't really look anything like that but a more workable version of the code above would be:
FOR EACH customer NO-LOCK where customer.contactmethod = 'E': /* without the NO-LOCK you might be aggravating a transaction scoping problem... */
MESSAGE "EMAILING TO" customer.customerCode customer.CustomerName.
do on error undo, leave: /* this may help to keep processing even if errors occur */
RUN Emaling.p (INPUT parameter 1,INPUT pramater 2 ....). /* you forgot the "." and knowing the rest of the parameters might help to suggest ways to get around the reported problem */
end.
END.

Related

MS Office 2013 Email Rules : How Do You Stop Auto Printing Rule based on Subject Line?

I'm used to coding and developing work, but recently I got a request to create actions in MS Office. I don't think that this needs a new script written, but I can be wrong. Just in case it's something more simple, I thought I'd just query here. Here is the dilemma:
Person A has a few MS Office rules that say: If a new email is received with the name XYZ in the subject line, automatically print it.
This rule works as it should. However, when there is back and forth correspondence, the emails no longer need printing. Only the initial email should print automatically. If Person A replies to the people at XYZ and they reply back or forward her a subsequent email, this should NOT print.
I had set up a new rule stating that if any emails are received with "RE:", "Re:" or "FWD:" in the subject line to "Stop processing more rules...".
However, all of Person A's emails started to print after this. I've removed the rule and I think that it may have only been a question of the priority in which the rule was listed. Meaning, that the new rule (catching emails with "RE:", "Re:" or "FWD:" in the subject line should have preceded all rules.
Is this the correct way to have handled this, or is there another way?
You can create a single rule which triggers a VBA macro if the subject contains a keyword. The VBA macro should look like the following one:
Public Sub Test(mail as MailItem)
'
End Sub
In the code you may check whether a subject string begins with the keywords or not. The InStr fuction returns the position of the first occurrence of a substring in a string.
The PrintOut method of the MailItem class prints the Outlook item using all default settings.The PrintOut method is the only Outlook method that can be used for printing.

magento: extra email recipients in order confirmation email

i have a peculiar problem, when customers receive an order confirmation email strangely this is also sent to some other older customers. I have searched file after file and do not know where this code is inserted, a previous developer inserted this and now very important i remove it. Which file is responsible to send out the new order confirmation email?
Check Your code on below location
app/code/core/Mage/Sales/Model/Order.php
Or(if file is override)
app/code/local/Mage/Sales/Model/Order.php
and find function around line no.1274
public function queueNewOrderEmail($forceMode = false)
and check $emailInfo->addTo($this->getCustomerEmail(), $customerName); function

phpmailer error codes for outcome processing

I am building a mailout capability and it is working OK as far as it goes. However, I want to distinguish between various potential (high level) outcomes in order to determine what happens to each message after the current send attempt.
This must be a common requirement so I seem to be missing something pretty obvious, but I can't find anything that addresses it, either here or via Google or on PHPMailer site or .. . Possibly because there are so many questions about specific errors that I just can't find anything useful in all the other results.
At very high level:
Attempt send, and assess resulting error/result. Identify whether this message has been sent, must be retried later, or failed permanently.
- success -> update message status as 'SENT: OK'
- sent, but some issues (e.g. one recipient failed, others processed OK)-> 'SENT: some error'
- failed, due to temporary problem (e.g. connection problem, attachment open) -> 'TRY LATER'
- failed, due to message-specific problem that we should NOT try to resend-> 'FAILED: some error'
As I was unable to find an existing resource with e.g. a table of errors, I spent some time working through the phpmailerException code to try to build one myself, but it's not simple because a) they don't appear to have been designed in terms of this kind of grouping logic, b) it is not easy to uniquely identify a particular error: PHPMailer provides human-friendly messages, which are different in different languages, rather than an identifiable code - given that my solution will need to work across different language installations that's a problem!
Obviously SMTP itself provides a range of errorcodes which I could potentially use for this purpose, but how do I access these via PHPMailer? (This would work for me as I only use SMTP at this point - however, this would NOT work if other message transport like sendmail was used, so I would prefer a PHPMailer solution)
If you want individual result codes for individual address, you really need to send each message separately. If you do get errors on some recipients, they will be listed in the ErrorInfo property - look in the smtpSend function to see how the error string is assembled. I agree that it's not especially easy to parse that info out. The error messages in PHPMailer are generally more for the developer than the end user, so the translations are not that significant. You can get slightly more information about errors if you enable exceptions rather than relying only on return values.

VBScript to modify email content type

I have incoming email set up for SharePoint 2010, and am sending forms from InfoPath using that method, with SMTP server set up on the SharePoint Server machine. It seems easier than elevating the permissions of an anonymous user with the InfoPath code-behind option. I also tried a custom method of sending the emails but was unable to find a way to send the form data along with the email message using the InfoPath 2010 code-behind option. So, I found another way, using the advice from SharePoint UK's website.
My problem is that while removing the x-mailer header actually solved my problem regarding whole email messages, it did not allow the attached form data to be sent to the library. The message would be imported and then just disappear if I did not have the "Save original e-mail" setting enabled. Inspecting messages in the drop folder I found they had a content type of "multipart/related" and if I edited them with NotePad++ I could change that to "multipart/mixed" and the attached form data would then be imported as desired.
So I went about trying to modify the VB Script to make this happen BUT now nothing happens with the script at all. Clearly I'm doing something wrong with it and VBScript really isn't my area of expertise. Maybe it's just not possible to edit those fields or maybe I need to attack it from a different angle. How can I get my VBScript to edit the content type for these emails?
CODE:
Set shell = CreateObject("WScript.Shell")
shell.LogEvent 4, "starting mail filter"
if instr(iMsg.Fields("urn:schemas:mailheader:content-type"), "related") > 1 then
Dim logMsg = "Mail Type: " & iMsg.Fields("urn:schemas:mailheader:content-type")
Dim tempType = Replace(iMsg.Fields("urn:schemas:mailheader:content-type"), "related", "mixed")
shell.LogEvent 4, iMsg.Fields("urn:schemas:mailheader:content-type")
iMsg.Fields.Delete("urn:schemas:mailheader:content-type")
iMsg.Fields.Item("urn:schemas:mailheader:content-type") = tempType
iMsg.Fields.Update
shell.LogEvent 4, iMsg.Fields("urn:schemas:mailheader:content-type")
end if
shell.LogEvent 4, "end mail filter"
iMsg.DataSource.Save
EventStatus = 0
I looked into this in greater detail and found that the content-type property of an email message is one of the many that is read-only using this particular vbscript library. So, I would have to find some other way of editing the file, and the work involved is more than what it would take to find an alternate solution that skipped email altogether. Therefore, I am abandoning the plan of using email in this case. If you take something away from this, let it be that there are read-only properties for the mail message object in this script.

Why does this AppleScript get an "AppleEvent handler failed" error on Mac OS X 10.5 Leopard?

First, I know, Leopard is the old-fogey at this point, but it's the minimum I'd like to be able to support with this script, so please bear with me (it's not even possible under Mac OS X 10.4 Tiger due to a bug w/Mail redirect/forward/reply bug I had uncovered long ago).
I've been revisiting building an AppleScript to work in conjunction with Topic Desk's spamtrainer, so it goes through a selection of messages in the Junk folder and attempts to redirect them to a specified mailbox. Here's what I have so far (note that the actual sending is commented out at the moment, more on that later):
(* Train Spam - Redirect (not forward) email from the Junk folder (which hasn't already been redirected or
* determined by the mail server to be spam) to an appropriate spam mailbox on the mail server.
* Developed to be used in conjunction w/spamtrainer on a Mac OS X Server mail server.
*
* v0.1 2011-07-27 - Morgan Aldridge
* Initial version.
*)
using terms from application "Mail"
on perform mail action with messages selectedMsgs in mailboxes selectedMailboxes
tell application "Mail"
-- configuration variables
set junkPrefix to "***JUNK MAIL***"
set junkRecipient to "junkmail#domain.tld"
-- ensure that we're in the Junk mailbox
-- (it'd be disasterous to accidentally redirect mail for training from another mailbox)
if (count of selectedMailboxes) is 1 and (first item of selectedMailboxes) is junk mailbox then
set selCount to (count of selectedMsgs)
set redirectedCount to 0
repeat with counter from 1 to selCount
set msg to item counter of selectedMsgs
-- if the subject doesn't start with junkPrefix and the message hasn't already been redirected, then redirect it
-- (otherwise, if it starts with junkPrefix, it means it was already detected as junk by the mail server)
-- (and, obviously, if it was already redirected, that was probably for the sake of junk training as well)
if subject of msg does not start with junkPrefix and not was redirected of msg then
set newRedirectMsg to redirect msg with opening window
tell newRedirectMsg
-- set the to recipient to that of the specified spam mailbox on the mail server
make new recipient at beginning of to recipients with properties {address:junkRecipient}
-- remove any bcc or cc recipient (we don't want to be spamming anyone else in the process)
delete bcc recipients
delete cc recipients
end tell
-- actually send the message
-- send newRedirectMsg
else
display dialog "Oops, the message was already flagged as junk by the mail server or you've already redirected it!"
end if
end repeat
else
display dialog "Oops, you're not in your Junk mailbox!"
end if
end tell
end perform mail action with messages
end using terms from
-- this is required when _not_ running from the Script menu (e.g. Script Editor, FastScripts, etc.)
using terms from application "Mail"
on run
tell application "Mail" to set sel to selection
tell application "Mail" to set selBox to selected mailboxes of message viewer 1
tell me to perform mail action with messages (sel) in mailboxes (selBox)
end run
end using terms from
When running it from Script Editor.app (so it goes through the on run and tell me to) and a small number of Junk messages select in Mail (this is under Mac OS X 10.5.8 Leopard), it seems to work for the first message (opening a new redirected message, w/to recipient set, and CC/BCC fields emptied), and the other redirected message windows open, but their To/CC/BCC fields are not updated and Script Editor.app pops up the dialog with the "Mail got an error: AppleEvent handler failed" error. The contents of the Event Log are as follows:
tell application "Mail"
get selection
{message id 464214 of mailbox "Junk", message id 464213 of mailbox "Junk", message id 464211 of mailbox "Junk"}
get selected mailboxes of message viewer 1
{junk mailbox}
get junk mailbox
junk mailbox
get subject of message id 464214 of mailbox "Junk"
": Your Invitation Into a Global Directory"
get was redirected of message id 464214 of mailbox "Junk"
false
redirect message id 464214 of mailbox "Junk" with opening window
outgoing message id 400031520
make new recipient at beginning of every to recipient of outgoing message id 400031520 with properties {address:"junkmail#domain.tld"}
to recipient 1 of outgoing message id 400031520
delete every bcc recipient of outgoing message id 400031520
delete every cc recipient of outgoing message id 400031520
get subject of message id 464213 of mailbox "Junk"
"Nominate Your Favorite Products for the Community Choice Awards"
get was redirected of message id 464213 of mailbox "Junk"
false
redirect message id 464213 of mailbox "Junk" with opening window
outgoing message id 378471104
make new recipient at beginning of every to recipient of outgoing message id 378471104 with properties {address:"junkmail#domain.tld"}
"Mail got an error: AppleEvent handler failed."
So, clearly it seems like the failure is with setting the to recipients in all but the first message. Subsequent runs of the script without relaunching Mail result in failures on the first message as well.
The oddest part of this issue is that, when quitting mail after running the script, there's a hidden, blank window for each of the redirected messages (even the one that was successful) that pops up asking if you want to save changes or not. This sounds very similar to something noted in this thread, but I'm not sure what causes it.
So, what's causing this error and failure? How can I resolve it? And, for extra credit, why are the hidden, blank messages created and how can I prevent that from occurring?
Your script looks fine to me.
If I were you, I would try running the script in another OS X account on the same computer, repair permissions, look at your logs (you've already done that, but it's still a good idea), run all relevant software updates, temporarily move your ~/Library/Mail folder to eliminate it as a factor, etc. Tell me what happens, especially if it works again :)