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
Richard ElgertAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Richard ElgertAuthor Commented:
help
KimputerCommented:
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?
Richard ElgertAuthor Commented:
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.

.
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

KimputerCommented:
The admin for the server at 192.168.168.69 will know just what to do with this. That's because the server doesn't want to send it for you (based on its own rules, for instance, routing only a select set of domains). It's NOT an error in your CDO code.
The admin for the mail server just has to allow you to send to that domain (probably a rule set up to prevent spamming).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Richard ElgertAuthor Commented:
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
KimputerCommented:
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?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Internet / Email Software

From novice to tech pro — start learning today.