Sales Order Status Email Generation

From Axaptapedia

A class designed to allow a developer to transmit an order status email message to customers. The email messages are in HTML form.


Contents

Download

Version 1.0.4 - 20060511

Legacy Versions:

Version 1.0.3 - 20060510

Version 1.0.2 - 20060508

Version 1.0.1 - 20060505

Version 1.0.0 - 20060504


News

(May 11 2006) - Version 1.0.4 Released

(May 10 2006) - Version 1.0.3 Released

(May 8 2006) - Version 1.0.2 Released

(May 5 2006) - Version 1.0.1 Released

(May 4 2006) - Initial Release


Version History

1.0.4 (20060511 - Jeremy Severson)

- (Jeremy Severson) Apply discount pricing to standard messages

- (Jeremy Severson) Stop showing the individual packages on the invoice.

- (Jeremy Severson) Show single tracking number

- (Jeremy Severson) Added GetTrackingNumberOrigin()

- (Jeremy Severson) Add note to confirmation pertaining to WIRE payment.

1.0.3 (20060510 - Jeremy Severson)

- (Jeremy Severson) Add confirmationId to the confirmation emails.

- (Jeremy Severson) Change to backorder notice text

- (Jeremy Severson) Add customer PO to the status

- (Jeremy Severson) Add shipping method information to status

- (Jeremy Severson) Apply discount pricing for confirmation messages.

1.0.2 (20060508 - Jeremy Severson)

- Retrieve contents of shipped boxes (starship support required)

- Added Function GetNumShippedPackages()

- Small adjustments to the holiday message functionallity.

1.0.1 (20060505 - Jeremy Severson)

- Retrieve recipient email from primary sales order contact record

- Add BCC capabilites

- Make init() and ProcessMessage() private functions.

- Implemented send confirmation dialog support.

- Retrieve company name from companyinfo table.

- Added GetLastConfirmationId()

- Added ReturnOrderDetail_Confirm()

- Added ReturnOrderTotals_Confirm()

- Added Copyright information

- Added GetLastInvoiceId()

- Adjustments to Order Detail font sizes.

- Added EURO character support to order detail functions.

1.0.0 (20060504 - Jeremy Severson) - Initial Release


Copyright Information

Copyright (c) 2006 Jeremy Severson, B&B Electronics All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
   derived from this software without specific prior written permission.
Alternatively, this software may be distributed under the terms of the
GNU General Public License ("GPL") version 2 as published by the Free
Software Foundation.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Developer Notes

This will require the addition of the following function to the CDOMail Class:

Required for the support of HTML email.

boolean sendHTMLMail(str    _toName,
              str    _ccName,
              str    _bccName,
              str    _subject,
              str    _body,
              str    _from = "")
{
    boolean ret = true;
 
    // This method is useful for sending multpile mails in quick sucession. Because the COM
    // objects are already defined, it is quicker, and is less likely to have COM errors when
    // sending several emails one after another.
    COMError errorCom;
    str      errorMsg;
    SysEmailParameters              parameters      = SysEmailParameters::find();
    ;
 
    if ( ! configured )
        this.Configure();
 
 
    if ( _from == "" )
        _from = parameters.SMTPUserName + '@' + parameters.SMTPRelayServerName;
 
    objMessage.To(COMVariant::createFromStr(_toName));
    objMessage.CC(COMVariant::createFromStr(_ccName));
    objMessage.BCC(COMVariant::createFromStr(_bccName));
    objMessage.From(COMVariant::createFromStr(_from));
    objMessage.Subject(COMVariant::createFromStr(_subject));
    objMessage.HTMLBody(COMVariant::createFromStr(_body));
 
    try
    {
        objMessage.Send();
    }
 
    catch (Exception::Internal)  // FYI: COM Exceptions cannot be caught inside ttsbegin/ttscommit blocks
    {
        // the 'load' method failed
        errorCom = objMessage.error();
        errorMsg = StrFmt("Method send failed. Error %1 (%2)",
                      errorCom.number(), errorCom.description());
        // display the error
        error(errorMsg);
        info(strfmt("To: %1", _toName));
        info(strfmt("CC: %1", _ccName));
        info(strfmt("BCC: %1", _bccName));
        ret = false;
    }
 
 
    //info("sent message");
    return ret;
}