Page 1 of 1

Problem with OnAcceptMessage...

Posted: 2011-11-02 12:55
by Rainer
Hello, is it possible, in the function: OnAcceptMessage to add an additional RecipientCC or RecipientBCC Name?

Kind regards :)

Re: Problem with OnAcceptMessage...

Posted: 2011-11-02 14:22
by Bill48105
Hi,
You have the message so you can edit it if desired, just use the mail path & edit the EML in the script before releasing it for delivery.

As far as smtp to/from check out:
http://www.hmailserver.com/forum/viewto ... 20&t=15301
That show examples of viewing/changing the to/from used for DELIVERY vs in the text of the mail use when VIEWING it.
Bill

Re: Problem with OnAcceptMessage...

Posted: 2011-11-02 14:56
by mattg
Or via the COM API you can add recipients (I think to the SMTP envelope only), add a CC header, or even copy the message and send the copy to only a set recipient.

Re: Problem with OnAcceptMessage...

Posted: 2011-11-02 15:03
by Rainer
Hello Bill, I really wanted to do this without editing the email. I tried using AddRecipient/AddRecipientBCC to add a new additional Recipient. The following error returns: Wrong number of arguments or invalid property assignment: 'oMessage.AddRecipient' - Line: 674 Column: 24 - Code: (null) '

Kind regards :)

Re: Problem with OnAcceptMessage...

Posted: 2011-11-02 15:08
by mattg
Are you doing it in the form

oMessage.AddRecipient(Name, Address)

Can you please show your AddRecipient line

Re: Problem with OnAcceptMessage...

Posted: 2011-11-02 15:15
by Rainer
Hello Bill, here are the lines:

oMessage.AddRecipient "Postmaster@MyDomain.de"
oMessage.Save
oMessage.RefreshContent

Or

oMessage.AddRecipientBCC "Postmaster@MyDomain.de"
oMessage.Save
oMessage.RefreshContent

Kind regards :)

Re: Problem with OnAcceptMessage...

Posted: 2011-11-02 15:41
by mattg
Hey Rainer,

(It's Matt not Bill btw)
Rainer wrote:oMessage.AddRecipient "Postmaster@MyDomain.de"
oMessage.Save
oMessage.RefreshContent
should be

Code: Select all

oMessage.AddRecipient "Postmaster", "Postmaster@MyDomain.de"
oMessage.Save
oMessage.RefreshContent
Matt

Re: Problem with OnAcceptMessage...

Posted: 2011-11-02 15:43
by Rainer
Hello Matt, the problem is solved:

If IsArray(MyUnerwuenschtArray) Then
For MyOuterRow = 0 To UBound(MyUnerwuenschtArray)
If Len(MyUnerwuenschtArray(MyOuterRow)) > 0 Then
If InStr(1, LCase(oMessage.Subject), LCase(MyUnerwuenschtArray(MyOuterRow)), vbTextCompare) <> 0 Then
'
oMessage.AddRecipient "", "Postmaster@MyDomain.de"
oMessage.Save
Exit For
ElseIf InStr(1, LCase(MyBody), LCase(MyUnerwuenschtArray(MyOuterRow)), vbTextCompare) <> 0 Then
'
oMessage.AddRecipient "", "Postmaster@MyDomain"
oMessage.Save
Exit For
End If
End If
Next
End If


Kind Regards :)

Re: Problem with OnAcceptMessage...

Posted: 2011-11-02 15:45
by mattg
Excellent!!

Glad you got it sorted

Re: Problem with OnAcceptMessage...

Posted: 2011-11-03 06:47
by Bill48105
Cool you got it Rainer thanks to MATTG helping. :D Btw does AddRecipient add the header to the email too or you were just wanting to add another SMTP recipient?
Bill

Re: Problem with OnAcceptMessage...

Posted: 2011-11-03 08:27
by Rainer
Good morning Bill!
Yes, the extra receiver is included in the header.

Kind regards :)