Email not working

Not sure if it matters, but all the examples I've seen/used had the line

run Bpm/BpmEmail.p persistent set hEmailEx.

following define variable statements before the query.



--- In vantage@yahoogroups.com, "adrian.lauchlan" <adrianlauchlan@...> wrote:
>
> I can't get the email from the code below to send - the msg is displayed ok though. I can't see where it is going wrong - anyone able to tell me?
>
> Define Variable vFrom as Character No-Undo initial '':U.
> Define Variable vTo as Character No-Undo initial '':U.
> Define Variable vCC as Character No-Undo initial '':U.
> Define Variable vBCC as Character No-Undo initial '':U.
> Define Variable vSubject as Character No-Undo initial '':U.
> Define Variable vBody as Character No-Undo initial '':U.
> Define Variable hEmailEx as Handle no-undo.
>
> FIND FIRST ttRcvDtl WHERE ttRcvDtl.Company = CUR-COMP AND ttRcvDtl.rowmod <> " " NO-LOCK NO-ERROR.
> IF AVAILABLE ttRcvDtl THEN
> FIND FIRST part WHERE ttRcvDtl.partnum = part.partnum NO-LOCK NO-ERROR.
> IF AVAILABLE part THEN
> DO:
> if part.checkbox19 = true then
> DO:
>
> ttRcvDtl.BinNum = 'INSP'.
> {lib/PublishEx.i
> &ExMethod = 'UpdateBefore'
> &ExTable = 'RcvDtl'
> &ExField = ''
> &ExMsg = "String(Part.PartNum) + ' Requires Inspection - Please inform the Inspection Team'"}
> {&THROW_Private}.
>
> run Bpm/BpmEmail.p persistent set hEmailEx.
> assign vFrom = vFrom + 'EpicorAdmin@<company>.com'.
> assign vTo = vTo + 'adrian@<company>.com'.
> assign vCC = vCC + 'adrianlauchlan@...'.
> assign vBCC = vBCC + 'adrian@...'.
> assign vSubject = vSubject + 'Inspection Required'.
> assign vBody = vBody + 'Inspection Required : PO Number: ' + String(ttRcvDtl.PONum) + ' Part: ' + String(ttRcvDtl.partnum) + ' Qty: ' + String(ttRcvDtl.VendorQty).
> run SendEmail in hEmailEx(false,CUR-COMP,vFrom,vTo,vCC,vBCC,vSubject,vBody,"":U).
> if valid-handle(hEmailEx) then delete procedure hEmailEx.
>
> /* {lib/PublishInfoMsg.i
> &InfoMsg = "'Inspection Required : PO Number: ' + String(ttRcvDtl.PONum) + ' Part: ' + String(ttRcvDtl.partnum) + ' Qty: ' + String(ttRcvDtl.VendorQty)"} */
>
> end.
>
> END.
>
I can't get the email from the code below to send - the msg is displayed ok though. I can't see where it is going wrong - anyone able to tell me?

Define Variable vFrom as Character No-Undo initial '':U.
Define Variable vTo as Character No-Undo initial '':U.
Define Variable vCC as Character No-Undo initial '':U.
Define Variable vBCC as Character No-Undo initial '':U.
Define Variable vSubject as Character No-Undo initial '':U.
Define Variable vBody as Character No-Undo initial '':U.
Define Variable hEmailEx as Handle no-undo.

FIND FIRST ttRcvDtl WHERE ttRcvDtl.Company = CUR-COMP AND ttRcvDtl.rowmod <> " " NO-LOCK NO-ERROR.
IF AVAILABLE ttRcvDtl THEN
FIND FIRST part WHERE ttRcvDtl.partnum = part.partnum NO-LOCK NO-ERROR.
IF AVAILABLE part THEN
DO:
if part.checkbox19 = true then
DO:

ttRcvDtl.BinNum = 'INSP'.
{lib/PublishEx.i
&ExMethod = 'UpdateBefore'
&ExTable = 'RcvDtl'
&ExField = ''
&ExMsg = "String(Part.PartNum) + ' Requires Inspection - Please inform the Inspection Team'"}
{&THROW_Private}.

run Bpm/BpmEmail.p persistent set hEmailEx.
assign vFrom = vFrom + 'EpicorAdmin@<company>.com'.
assign vTo = vTo + 'adrian@<company>.com'.
assign vCC = vCC + 'adrianlauchlan@...'.
assign vBCC = vBCC + 'adrian@...'.
assign vSubject = vSubject + 'Inspection Required'.
assign vBody = vBody + 'Inspection Required : PO Number: ' + String(ttRcvDtl.PONum) + ' Part: ' + String(ttRcvDtl.partnum) + ' Qty: ' + String(ttRcvDtl.VendorQty).
run SendEmail in hEmailEx(false,CUR-COMP,vFrom,vTo,vCC,vBCC,vSubject,vBody,"":U).
if valid-handle(hEmailEx) then delete procedure hEmailEx.

/* {lib/PublishInfoMsg.i
&InfoMsg = "'Inspection Required : PO Number: ' + String(ttRcvDtl.PONum) + ' Part: ' + String(ttRcvDtl.partnum) + ' Qty: ' + String(ttRcvDtl.VendorQty)"} */

end.

END.