1. Introduction 2. Getting Started 3. Attachments 4. Embedded Images 5. Security 6. Unicode 7. Queuing Part I 8. Queuing Part II Object Reference |
Chapter 8. Message Queuing. Part II
Logging
A typical failure entry may look as follows:
2003/02/20 17:51:31.793 File:20030220-17512416-980-0 From:<user@aspupload.com> To:<info@persits.com> FAILURE: SMTP connect to servername:25
A success entry may look as follows:
2003/02/20 17:55:03.578 File:20030220-17545845-980-0 From:<user@aspupload.com> To:<info@persits.com> SUCCESS: Sending to imail.innerhost.com [imail.hosting.innerhost.com]: 250 Message queued
All entries contain a timestamp, the name of a file containing the message, the From: and To:
information, and a reason for failure (or a success notification from the SMTP server).
Whether to log all messages or errors only can be set on the Log tab:
If you opt to log error messages only, you may also choose to log POP3 retrievals.
These types of log entries are useful for bounced message handling described below.
The following code snippet opens the current log file and displays
all entries in it:
For Each Record in Logger.Records
Logger.Close
The Open method accepts an optional argument specifying the location
of the log file. If nothing is specified, the default log file is opened.
The Records property returns the collection of LogEntry objects
representing individual log entries. The LogEntry object supports the following
properties:
Text - returns the entire log entry text.
FileName - returns the filename of the message file responsible for this entry.
DateTime - returns timestamp information for this log entry.
Status - returns the strings "SUCCESS", "FAILURE", "ERROR", "SYSTEM" or "RECEIVED" for a successful
send, failed send (non-fatal, message will be resent), failed send (fatal, message will not be resent),
system error, or received email, respectively. Mail receiving is covered later
in this chapter.
Recipient - returns the recipient address. This property is particularly useful for
bounced mail handling purposes (covered below).
Bounced Mail Handling
You must take the following steps to set up a bounced-mail handling framework
using AspEmail 5.0:
Step 1. Set up a "sink" mail account where all bounced messages would go.
Let's call it bounced@yourcompany.com. You may also use an existing mail account.
Step 2. In your mail-sending script, set the property Mail.MailFrom to
the "sink" address:
Mail.MailFrom = "bounced@yourcompany.com"
This ensures that all bounced messages will come to this address, and not the one
specified via Mail.From.
Step 3. Configure EmailAgent's POP3 tab:
The option "Disable APOP" should be used if your POP3 server does not support
APOP authentication, which is rare.
Step 4. During and after a batch send, EmailAgent will retrieve
bounced messages from the "sink" account and place them into the \Incoming subfolder underneath
the main message queue folder. At the same time, an entry will be added to the log,
which may look as follows:
2003/02/28 13:20:13.637 SUCCESS: Received message #1 C:\Queue\Incoming\2816cd831.eam-rcv (11297 bytes) Original-Recipient=username@somecompany.com
You can now retrieve and process all bounced mail addresses using
the EmailLogger component, as follows:
For Each Record in Logger.Records
Logger.Close
You can replace the "Do something" line with ADO-based script
that removes the Record.Recipient value from your address database.
Note that Record.Recipient can sometimes be empty as it is not always possible
to extract a recipient address from a bounced message, therefore you must
test this property for an empty value.
IMPORTANT: You must enable the option
"Log all messages" or check the box "Log POP3 Retrievals" on the Log tab for the bounced-message feature to work.
Copyright © 1999 - 2003 Persits Software, Inc. All Rights Reserved Questions? Comments? Write us! |