Outlook 2007 - Replace email body with custom text

Status
Not open for further replies.

divan

Member
Outlook version
Outlook 2007
Email Account
POP3
I have a rule to run a script upon receiving email from a specific account.

The script takes the email body and place it in my subject (placing my subject with body)

Now I want the script to remove or clear the email body before it forwards it to the email recipient, I want it to be black or with custom text.

This is my script:
Sub ChangeSubjectForward(Item As Outlook.MailItem)
Item.Subject = Item.Body
Item.Save
Set myForward = Item.Forward
myForward.Recipients.Add "fake_email@gmail.com"
myForward.Subject = Item.Body
myForward.Body = "XYZ"
myForward.Send

End Sub
___________________________________________________


My script does add the XYZ into the body and appears to send it as a email with body "XYZ" .....but this is what I get on the received email body:


Date: Thu, 15 Jan 2015 20:50:51 +0200

Message-ID: <000001d030f4$30db3450$92919cf0$@co.za>

MIME-Version: 1.0

Content-Type: text/plain;

charset="us-ascii"

Content-Transfer-Encoding: 7bit

X-Mailer: Microsoft Office Outlook 12.0

Thread-Index: AdAxWK3sf5r0IidSSTii+P0kIpfaEgAZIF+A

Content-Language: en-za

x-cr-hashedpuzzle: AMFR AjsP BRgi Bbgt B8Kp CGRh DIOr DSp2 DSt4 DbAo Dl8w D9Dg E0H+ E/H4 G7XL Hbpr;1;YwB0AHMAdABvAHIAZQBAAGsAbwB2AGMAbwAuAGMAbwAuAHoAYQA=;Sosha1_v1;7;{B5928C4F-F89F-42CA-A50D-293A9CEE100A};eABvAGwAYQBAAHgAbwBsAGEALgBjAG8ALgB6AGEA;Thu, 15 Jan 2015 18:50:47 GMT;VABlAHMAdABpAG4AZwAgAHQAaABlACAAbQBhAGkAbAA=

x-cr-puzzleid: {B5928C4F-F89F-42CA-A50D-293A9CEE100A}


XYZ
 

divan

Member
Outlook version
Outlook 2007
Email Account
POP3
If I send a mail with no body to my outlook with script, then the forwarded email (from outlook with script) has only the body which I added in the scrip.
But when the email has text in body my outlook script does not remove or clear the sent email.body.

This is what is added which I want removed completely:

Date: Mon, 19 Jan 2015 08:42:28 +0200
Message-ID: <000001d033b3$1a2ec660$4e8c5320$@co.za>
MIME-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 12.0
Thread-Index: AdAzsgvdJDRuShGcSiaP+wcwbJIN/QAAQvAw
Content-Language: en-za

XYZ
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
I'd check the Body content that you add to the Subject property. It looks like the stuff you're copying to the Subject is not allowed and kind of corrupts the email.
 

divan

Member
Outlook version
Outlook 2007
Email Account
POP3
I am only using script to copy over... where or how can I adjust it?

This is my script:
Sub ChangeSubjectForward(Item As Outlook.MailItem)
Item.Subject = Item.Body
Item.Save
Set myForward = Item.Forward
myForward.Recipients.Add "fake_email@gmail.com"
myForward.Subject = Item.Body
myForward.Body = "XYZ"
myForward.Send
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
See the line where you write the Body into the Subject property. What does the Body contain, why do you want to copy it to the subject?
 

divan

Member
Outlook version
Outlook 2007
Email Account
POP3
The I have a CCTV system that sends a email when a movement alarm is triggered. Now I want to send the email to another system in a specific format so that it can be converted into a sms.
The SMS system uses the subject of the email as the sms and the body as the destination, thus me wanting to have limited characters in the subject and be able to have the body to only show what I put in, like my example of "XYZ"

This is what is the format that can not be altered on the CCTV system itself:
Email Subject:
Movement Alarm
Email Body:
Unit: 0 Version:03.091
Movement Alarm
Continuous Movement
Back Office
Zone 3
2015/01/20 @ 07h15
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
I think 160 chars is the limit of a simple sms, isn't it? Try if limiting the subject to 160 chars works.
 
Status
Not open for further replies.
Top