How to send Mail with attachment

email
mail-attach

#1

Good Day!

In my current project I am using web harvest mail tag to send a mail with attachment(.xlsx/.pdf). whenever we attach some attachment, we can receive only a file format.

Can you please guide me in getting correct file format.

  <mail smtp-host="mail.xxxx.xx.xx"
      smtp-port="25"
      type="html"
      from="kathirvel.balasubramaniam@xxxx.xx.xx"
      reply-to="kathirvel.balasubramaniam@xxxx.xx.xx"
      to="kathirvel.balasubramaniam@xxxx.xx.xx"
      subject="Test"
      charset="UTF-8"
      security="tsl">
   
      HI, i am just testing email process
    <mail-attach name="VAF" mimetype="application/octet-stream">
      <file path="C:/Users/C738624/Desktop/VAF.xml" type="binary"/>
    </mail-attach>
</mail>

Sending mail via RPA Express
Send email with custom script (groovy)
Resolve HTML Template
#2

@aharhots

Here is a working example:

        <?xml version="1.0" encoding="UTF-8"?>
        <config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config">

        	<mail smtp-host="smtp.something.com" 
              smtp-port="465" 
              type="html"
              from="you@something.com"
              to="your_friend@other.com"
              subject="mail-test-plugin"
              charset="UTF-8"
              username="your_email@something.com"
              password="your_password"
              security="ssl">
              
            	mail content  
            
            <mail-attach name="application.pdf" mimetype="application/octet-stream">
              <file path="c:\Users\azinchuk\Downloads\application.pdf" type="binary"/>
            </mail-attach>

     <!-- Or use relative URL (from your configs folder):  -->

            <mail-attach name="input.csv" mimetype="application/octet-stream">
              <file path="..\input\input_data_file.csv" type="binary"/>
            </mail-attach>
         	
           </mail>
         	
            <export include-original-data="true"></export>
            
        </config>

Can we send email with attachment in RPA Express
#3

Thank you tested and working… Appreciated


#4

I have a scenario to attach a file to a mail which we are sending via plugin in WF (reference takne from this forum post: https://forum.workfusion.com/t/how-to-send-mail-with-attachment/351)

What I am doing is creating a file in the WF server and then give that file location to the “File plugin” using “path” attribute, similar to below code snippet, and then deleting the file from the file system.

My questions are:

  1. Is this a correct approach to do this, considering we will be creating a file in the file system of WF server? If not please explain the correct way of doing this.

  2. Is it possible to provide a URI ( e.g: S3 location) to the “path” attribute of the “file” plugin?


#5

@hhtdthilakarathne,

The file needs to be located on WF server if you are executing the bot task from the Control Tower web application.

The given example has local path because it is a training example and it is executed from WF Studio on a local machine.

You can attach any binary data - see https://kb.workfusion.com/display/WF/Standard+Web-Harvest+processors#StandardWeb-Harvestprocessors-mail-attach

If you want to download a file via http, you can use the following code:

<file action="write" path="123.txt">
    <http-extended url="https://s3-file-link" method="GET" content-type="application/json">
</file>

#6

Thank you for the reply. I am using the control tower web application. Is there a specific directory within the WorkFusion server which we can use to download these temporary files to? Or is it okay if the file path is set to any directory we wish?


#7

@hhtdthilakarathne,

it is better to use the /tmp folder. But do not forget to clean this folder on a regular basis.


#9

I am trying to send mail with attachment .I am getting “Error reading file: C:/download.jpg”.Though file exists in this path the error is mentioned as file doesn’t not exists.Can you please help me to resolve this issue.