Search The ForumSearch   RegisterRegister  LoginLogin

MailBee Objects

 AfterLogic Forum : MailBee Objects
Subject Topic: Received headers Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
joelmoss
Newbie
Newbie


Joined: 18 November 2005
Online Status: Offline
Posts: 1
Posted: 18 November 2005 at 7:08am | IP Logged Quote joelmoss

I have an existing mail message including headers, that I am feeding into the Message Object so I can manage the message and modify it as follows:

Dim Msg = CreateObject("MailBee.Message")
Msg.rawbody = MailMessage
Msg.ToAddr = "bob@bob.com"

This all works great, but when I view the rawbody after the above code, the headers of the original message have been modified (fine), but the 'Received' headers have been removed. Why is this? I need them keeping, how can I keep them in my message while the Message object modifies the message?
Back to Top View joelmoss's Profile Search for other posts by joelmoss
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 18 November 2005 at 11:13am | IP Logged Quote Alex

Setting ToAddr causes the message to be rebuilt. Since Received headers usually make no sense for modified messages, they are removed.

However, if you'd like to resend the received message without changes, you may use the SMTP.SendEx method as shown below:

Code:

SMTP.SendEx , "bob@bob.com"

The message will be resent to "bob@bob.com" without any changes (To field in the message itself will still contain original value, not bob@bob.com).

Another possible solution is to set the Message.MinimalRebuild property value to True, and then modify To: field using AddHeader method. When MinimalRebuild=True, MailBee interprets the message
only as a set of header lines plus body data.

The code below changes just To: header of the message (we assume msg already contains the message received from the server, imported from a file, etc):

Code:

msg.MinimalRebuild = True
msg.AddHeader "To", "bob@bob.com"
msg.RemoveHeader "CC"
...
msg.Send


Now, the message will be resent to bob@bob.com. Unlike SendEx approach, bob@bob.com will now appear in To: field.

Also, we remove CC to avoid double-sending to CC recipients. Removing BCC is not required since this field is not included into message headers anyway.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide