How to set Gsuite mail header

HI Team,

can you please tell me how to set the header parameters while sending the mail by using g-suite… the below are the parameter values which needs to be set

Content-Type: image/jpeg; name=“image001.jpg”
Content-Disposition: inline; filename=“image001.jpg”
Content-Transfer-Encoding: base64
Content-ID: image001.jpg@01D5D051.58EE0560

i have tried using the mailMessage.Headers(“Content-Type”) but this is not working out…

Hi @umundla
have you tried looping through for each item and check item.Headers(“Content-Type”)

Ashwin S

HI @AshwinS2,
thanks for the reply… i have looped in for each and assigned, im able to see the value in the log, but when i see the Mail in Gmail client, the values are not set.


Those cannot be set using the headers property, they will be overwritten on message sending…

HI @bcorrea,

im trying to send the Image as inline/embed in message body using gsuite activity.
when i set the values using Java program, im able to see the headers. but the same is not happening while doing with UiPath… is there any other activity which can be used to send the images inline/embed in the message body… the image is displaying as Attachment and not as inline. so im trying to set these headers…

try like this when creating your MailMessage object:

mail.Headers.Add("Content-Type", "image/jpeg; name=""image001.jpg"")

HI @bcorrea

thanks for the reply… tried the option ,but im seeing compilation error.

New MailMessage().Headers.Add(“Content-Type”, “image/jpeg; name=”+“C:\output\BdayImages_bkp\HB”+randomNmbr.ToString+".jpg")

You cant do it all inside an assign… those kinds of things need to be done in an invoke code activity as they are more complex…

oh… if possible can u share me a sample invoke code activity for assigning the values.

Invoke Code may look scary at first, but they actually are not, you will need to create an argument In/Out for the MailMessage, and some In arguments for whatever you will need to set dynamically in your headers…