Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
marcel_olmo
Partner Ambassador
Partner Ambassador

Change Header of a Email by Macro - vbscript

Hi guys I have a macro to send emails in vbscript like this:

Dim objEmail

objEmail.To = mailto (mailto is a variable with the mail )

objEmail.From =  getVariable("vEmailFrom")

objEmail.Sender = getVariable("vEmailAlias")

objEmail.Subject = mailSubject 

objEmail.TextBody = ""

What I'm  trying to do is to change the header of the mail.

As default my mail shows the name of the username who sends the email, but I want to change the header whenever I want. Any ideas ?

I want something like :

objEmail.setNewMailHeader = "Hello Header Mail")

But I've found no property to change the header of the email.

If anybody knows how to do it, I'll appreciate that.

Many thanks in advance!!!

1 Solution

Accepted Solutions
Not applicable

Hi,

I found the solution for your Query,

I tried it and its working fine for me

just use the below line and it will change header for you,

objEmail.From = """Hi How are you"" <yourcompany@domain.com>"

Hope this will help for you,

Thanks

View solution in original post

7 Replies
Not applicable

hmmm

objEmail.Subject = mailSubject  - that is the header definition

so if You just write:

objEmail.Subject = "Hello Header Mail"

should be ok

marcel_olmo
Partner Ambassador
Partner Ambassador
Author

Thanks Pari for your response,

I don't think this is the header, this is just the subject of the message.

The structure is the following :

<header>               <hour the email was sent>

<subject>

Where the header is usually the name of the account which sends the message.

This is an example :

Example.png

If you know the answer, I'll apreciate your help.

Regards, Marcel.

Not applicable

Hi,

you can use Variable to store temporary your mail header like,

Dim VmailSubject

VmailSubject = "Hello Header Mail"

objEmail.Subject = VmailSubject

you can change variable value dynamically according to your logic,

Hope this will help you,

Thanks

marcel_olmo
Partner Ambassador
Partner Ambassador
Author

I appreciate your answers.

My problem is not the subject, is the header.

if you see the image attached above, you'll see what I'm talking about.

Header -> Marcel Olmo Arnaiz.

Subject -> Hello, this is an example.

Example.png

Not applicable

ok so try this:

objEmail.From = "Barack Obama" 

Not applicable

Hi,

I found the solution for your Query,

I tried it and its working fine for me

just use the below line and it will change header for you,

objEmail.From = """Hi How are you"" <yourcompany@domain.com>"

Hope this will help for you,

Thanks

marcel_olmo
Partner Ambassador
Partner Ambassador
Author

Thanks Raj N, as easy as it sounds!!

Regards, Marcel.