Link to home
Start Free TrialLog in
Avatar of Richard Elgert
Richard Elgert

asked on

CDO mail

I have code to send CDO emails to vendors - all works fine except now have a vendor with subdomain in address like this  for example rich.smith@PW.UOC.Com - that fails - is there a way around it with CDO
Avatar of Richard Elgert
Richard Elgert

ASKER

help
Avatar of Kimputer
Try to capture the mail conversation (for instance, Wireshark. If it passes through another of your server, capture there also). Subdomains have no influence on how CDO works. It's probably something else. Could you post your code too?
I have no way to track the other stuff but error message says
Email error:  - 07:48:14 08/28/15 Error occurred while accessing component property/method: Send.
The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay

Error code: 0x80020009 SendCDOMail C:\symwork\p91824_CDOMail2015.ped (5890) - Number -  5890
but all emails work so

code
DEF VAR MyMailTo   AS CHAR.
DEF VAR MyMailFrom AS CHAR.
DEF VAR MyCCTo     AS CHAR.
DEF VAR MySubJect  AS CHAR.
DEF VAR MyMessage  AS CHAR.
DEF VAR MyFilePath AS CHAR.
DEF VAR MyErrorMessage AS CHAR.
DEF VAR MyNMRCost AS INT.


/* MyMailTo   = "becky.evans@mjsections.co.uk". */
/* MyMailTo   = "Richard.Elgert@paradigmprecision.com". */
MyMailTo   = "janet.denis@pw.utc.com".

/* MyMailTo   = "Janet.Denis <janet.denis@pw.utc.com>". */
/* name not final _PostingGroup@paradigmprecision.com Ali working on getting group set up */
/* MyMailTo   = MyMailTo + "_PostingGroup@paradigmprecision.com". */


MyMailFrom = "server@paradigmprecision.com".

MyCCTo     = "Richard.Elgert@paradigmprecision.com".
MySubJect  = "Testing email from code ".
/* add as much info as possible */
MyMessage  = "Please advise if you received this.".


RUN SendCDOMail.
/* always reset variables */
MyMailTo   = "".
MyMailFrom = "".
MyCCTo     = "".
MySubJect  = "".
MyMessage  = "".

   
QUIT.


PROCEDURE SendCDOMail.

    DEF VAR cFileName      AS CHAR NO-UNDO.
    DEF VAR MyCDOFrom      AS CHAR NO-UNDO.
    DEF VAR MyCDOTo        AS CHAR NO-UNDO.
    DEF VAR MyCDOMsg       AS CHAR NO-UNDO.
    DEF VAR MyCDOSubj      AS CHAR NO-UNDO.
    DEF VAR MyCDOCC        AS CHAR NO-UNDO.
    DEF VAR MyCDOAttach    AS CHAR NO-UNDO.
    DEF VAR MyCDOHyperLink AS CHAR NO-UNDO.
    DEF VAR oSuccessful    AS LOG  NO-UNDO.

    MyCDOFrom = MyMailFrom.                  
    MyCDOTo   = MyMailTo.
    MyCDOCC   = MyCCTo.     /* "relgert@tct-inc.com". */
    MyCDOSubj = MySubJect.
    /* this for text only message see below for HTML */
    MyCDOMsg  = MyMessage.
    MyCDOAttach = "".               /* MyExcelFile. */
    /* must have FILE:// for hyperlink to work */
    MyCDOHyperLink = "".    /*"File://" + cFileName.*/
   
    DO ON ERROR UNDO, LEAVE:
        DEF VAR objMessage AS COM-HANDLE.
        /* RDE 8/7/12 this was a return from  */
        oSuccessful = YES.
        CREATE "CDO.Message" objMessage.
        objMessage:Subject  = MyCDOSubj.
        objMessage:From     = MyCDOFrom.
        objMessage:To       = MyCDOTo.
        objMessage:CC       = MyCDOCc.
        /* this works */
        objMessage:HtmlBody  = MyCDOMsg.
        /* this works */
        /*objMessage:AddAttachment(MyCDOAttach,"","").*/
        /* = 2 is norm casarray.palmermfgco.local */
        objMessage:Configuration:Fields:Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2.
        /* Name or IP of remote SMTP server */
        objMessage:Configuration:Fields:ITEM("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "192.168.168.69".
        /*         'Server port             */
        objMessage:Configuration:Fields:ITEM("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25.
        /* this line gives error on subdomain in address */
        objMessage:Configuration:Fields:Update().
        objMessage:Send().
        /* RDE 8/7/12 this was a return from SMTP */
        CATCH eError AS PROGRESS.lang.ERROR:
            oSuccessful = NO.
            MyErrorMessage = eERROR:getmessage(1) + " - Number - " + STRING(eERROR:getmessageNum(1),"zzzz9").
            RUN WriteErrorToFile.
        END CATCH.
    END.
END.


PROCEDURE WriteErrorToFile.
    OUTPUT TO R:\ErrorFolder\PostingEMailErrors.txt APPEND UNBUFFERED.
    PUT UNFORMATTED "Email error:  - " + STRING(TIME, "HH:MM:SS") + " "  
        + STRING(TODAY,"99/99/99") + " " + MyErrorMessage SKIP.
    /*  + STRING(TIME, "HH:MM:SS") + " " */
    OUTPUT CLOSE.
END.

.
ASKER CERTIFIED SOLUTION
Avatar of Kimputer
Kimputer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I've requested that this question be closed as follows:

Accepted answer: 0 points for Huntlee2015's comment #a40951837

for the following reason:

don't know if correct sys admin people have not responded to my help ticket
Just because someone else didn't respond or confirm my answer doesn't mean you should have your own comment assigned as the correct solution?