How to use <mail> plugin to send emails?

How to use Webharvest IDE plugin to send emails? we have samples in KB, but not working.

<mail smtp-host="smtp server" 
      smtp-port="smtp server port" 
      type="content type"
      from="sender"
      reply-to="reply-to header"
      to="to"
      cc="cc"
      bcc="bcc"
      subject="subject"
      charset="charset"
      username="smtp username"
      password="smtp password"
      security="smtp security type">
    mail content with optional attachments (mail-attach elements)
</mail>

This code is not working and it says 'javax.mail.MessagingException: Could not connect to SMTP host: eventhough mail server is valid and running on port 25.

Caused by: javax.mail.MessagingException: Could not connect to SMTP host: ;
nested exception is:
java.net.SocketException: Permission denied: connect

Hi @venkata.saripella,

To use this plugin, you need to enter your real SMTP server (for example smtp.yandex.com), port (465), and credentials.

1 Like

Thank You. I will try,

This is what I tried.

It is not exactly with real SMTP server. It worked directly when i am sending email from Linux box to email server (Linux Box). Earlier I was trying to send email from windows box which is controlled by fire wall. Thank You anyway,

One more question: how to send variables to body of the email. for example I have variable string abcd having some value and i want to add variable abcd to the body of the email. I tried adding ${} same way as Subject. Subject is working, but body it is not working.

hi @venkata.saripella

try the standard <var> webharvest plugin: http://web-harvest.sourceforge.net/manual.php#var

<?xml version="1.0" encoding="UTF-8"?>

<config>

	<var-def name="abcd">
		SOME_VALUE
	</var-def>

	<mail smtp-host="smtp.example.com" 
          smtp-port="587" 
          type="text"
          from="venkata@example.com"
          to="venkata@example2.com"
          subject="mail-test-plugin"
          charset="UTF-8"
          username="venkata@example.com"
          password="super_secure_password"
          security="ssl">
      
        mail content text and your variable value:  
        <var name="abcd"/>
    
	</mail>
</config>

Thank You I will try.

Thank You, It worked.

I want to send html content in email body. for example


Greetings!

This is not working. do you have any idea?

@venkata.saripella,

It can be done by changing the “type” to “html” and using the CDATA for your html code:

<var-def name="abcd">
	SPA
</var-def>
<mail ............... 
  type="html" .........>
  
	Using HTML content in your email:
    <![CDATA[
    	<p><a href="https://workfusion.com">WorkFusion Inc.</a> is providing <strong>SPA*</strong></p>
    ]]>

    <![CDATA[<hr><em>]]>
    *<var name="abcd"/> - Smart Process Automation
    <![CDATA[</em>]]>

</mail>
1 Like

@azinchuk

Let’s post a quick how-to based on this discussion and link here.

thank you, will try.

@mabramchik, @venkata.saripella,

Here is a how-to in our knowledge base: https://kb.workfusion.com/display/WF/Working+with+Emails

1 Like

Also another way to resolve variables in email body (or any other element which takes body text as content) is to use <template> tag:

<mail ...>
    <template>
        Execution report for week ${execution_week} of ${execution_year}:
            Number of records processed: ${number_of_records}
            Processed automatically: ${processed_by_machine}
            Processed by human force: ${processed_by_human}
            Report Generation Date: ${new Date()}
    </template>
</mail>
2 Likes

How can I get access to the knowledge base article? The login from the forum don´t work with the knwoedge base

@yves_deja - see this topic - How to register an account to login Workfusion Knowledge Base?

I had an list array and I want to write this array into a file and mail it. But, here I don’t have s3 bucket to write array into some file in S3 and mail the path of the file. Also, I cant save the file in local drive, because here rpa server is windows and application server is Linux. I cant access file from windows to Linux. could you please suggest the solution.

Hi, I am trying to connect to SQL server and run a sql query to get some value, Which I have working in eclipse using java and sqljdbc driver like a charm. In Workfusion RPA, so far I have understood after going through this forum it can not be accomplished with java or groovy code. Instead Web-Harvest Processor has to be used. So would you point me to documentation or guide for the steps I need to follow to implement Web-Harvest Processor and use in Custom Action.

Best–

Manoj