Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
New Contributor
Posts: 4
Registered: ‎06-21-2016
Accepted Solution

sending email to list of recipients via smtp

[ Edited ]

Hi everyone,

 

I'm trying to send an email to a list of people, but when i put the list of recipients, the only one to recieve it is the last one. 

 

the code is as follows:

 

workflowsettings:

 

 

 

<WorkflowTrigger name="MailTrigger" type="MailTrigger" method="after">
                        <Param name="From" value="test@****.com" />
                        <Param name="Recipients" value="recipient1@****.es, recipient2@***.es, recipient3@***.es" />
                        <Param name="Subject" value="Prova" />
                        <Param name="Body" value="{Form.TEXT}" />
</WorkflowTrigger>


 

web config:

 

<system.net>
    <mailSettings>
      <smtp from="test@*****.com">
        <network host="smtp.*****.com" port="25" userName="*********" password="*********"  />
      </smtp>
   </mailSettings>
  </system.net>

 

Am i doing something wrong?? with this code the only recipient to recieve the email will be the recipient3.

 

thanks in advance, and sorry for my english.

Regular Contributor
Posts: 238
Registered: ‎05-01-2016

Re: sending email to list of recipients via smtp

Have you tried separating the recipient names with semicolons ; rather than commas?

Staff
Posts: 890
Registered: ‎10-18-2015

Re: sending email to list of recipients via smtp

Hi,

 

you can use a formtable to get the list of recipients in your workflow trigger.

 

HTH,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
New Contributor
Posts: 4
Registered: ‎06-21-2016

Re: sending email to list of recipients via smtp

Hello!

 

We've tried with semicolons, /, \ and everything we could think off, without luck.

 

About using a FormTable, could you give us an exemple of how to use it?

 

Thanks for your help!

Staff
Posts: 890
Registered: ‎10-18-2015

Re: sending email to list of recipients via smtp

Hi,

 

you can have a table like this:

<FormTable name="EDITOR" visible="list,form" label="Editor " required="false" idfield="EMailAddress" 
	lov="SQL[Select e.LoginName, e.FirstName,e.LastName,e.EMailAddress From Employee e 
	Inner Join Employee_REGION er on e.ID = er.EMPLOYEE_ID and er.REGION_ID = {FORM.REGION_ID} order by LastName,FirstName]" 
	defaultvalue="SQL[select LoginName from Employee where LoginName={User.Name}]">
  <FormTableField name="LoginName" label="User name"/>
  <FormTableField name="FirstName" label="First name"/>
  <FormTableField name="LastName" label="Last name"/>
  <FormTableField name="EMailAddress" label="E-Mail"/>
</FormTable>

and this would be the trigger:

<WorkflowTrigger name="SampleMailTrigger" method="action" type="MailTrigger">
  <Param name="From" value="{FORM.OWNER_EMAIL}" />
  <Param name="Recipients" value="{FORM.EDITOR}" />
  <Param name="Subject" value="Test Multiple Recipients" />
  <Param name="Body" value="Hello, this is a test" />
</WorkflowTrigger>

The FormTable can even be hidden and you can automatically select the row you would like to use.

 

HTH,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
New Contributor
Posts: 4
Registered: ‎06-21-2016

Re: sending email to list of recipients via smtp

 

Hello!

 

I've been trying to use a table, without success. I'll attach how i've got it configurated right now.

 

 

First the Table. I want to send the mail to everybody in there.

 

<FormTable name="EMAILS_TABLE" lov="SQL[select NAME, EMAIL from TABLE]" persisted="false" 
idfield="CORREU" > 
<FormTableField name="NAME" /> <FormTableField name="EMAIL" /> </FormTable>

 

Next the trigger. I'm using the method after.

 

 

<WorkflowTrigger name="SEND_MAILS" type="MailTrigger" method="after">
    <Param name="From" value="XXX@XXX.com" />
    <Param name="Recipients" value="{FORM.EMAILS_TABLE}" />
    <Param name="Subject" value="Subject" />
    <Param name="Body" value="Hello!" />
</WorkflowTrigger>

 

And the error I've got when I check the log:

27.06.2016 10:29:48 ERROR - Controller Form has raised an exception in Action Save.
System.InvalidOperationException: A recipient must be specified.
   at System.Net.Mail.SmtpClient.Send(MailMessage message)
   at Intergraph.Emea.Workflows.MailTrigger.Execute()
   at Intergraph.Emea.Workflows.TriggerController.ExecuteTriggers(TriggerExecution triggerExecution, IEnumerable`1 workflowTriggerDescriptions, IWorkflowControllerContext workflowControllerContext, WorkflowData workflowData)
   at Intergraph.Emea.Workflows.TriggerAttribute.ActionExecuted(ActionExecutedContext filterContext)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass48.<InvokeActionMethodFilterAsynchronouslyRecursive>b__41()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass48.<InvokeActionMethodFilterAsynchronouslyRecursive>b__41()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass48.<InvokeActionMethodFilterAsynchronouslyRecursive>b__41()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass48.<InvokeActionMethodFilterAsynchronouslyRecursive>b__41()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass48.<InvokeActionMethodFilterAsynchronouslyRecursive>b__41()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass48.<InvokeActionMethodFilterAsynchronouslyRecursive>b__41()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)

Thanks again for your help!

Staff
Posts: 890
Registered: ‎10-18-2015

Re: sending email to list of recipients via smtp

only the checked items in the table will be used. The FormTable itself is the list of selected IDs. So basically you missed the defaultvalue in your definition ora piece of Javascript code to get the elements selected.

 

Stefano

 

 

Stefano Turcato
Presale Engineer
Hexagon Geospatial
New Contributor
Posts: 4
Registered: ‎06-21-2016

Re: sending email to list of recipients via smtp

I've finally managed to make it work.

 

Thank you!

Occasional Contributor
Posts: 12
Registered: ‎08-14-2017

Re: sending email to list of recipients via smtp

Hi, Can you share how to send multiple recipients in the mailtrigger?

Thanks

Occasional Contributor
Posts: 12
Registered: ‎08-14-2017

GMSC Multiple CC and Recipient in MailTrigger

Hi,

 

I'm using GMSC 2016 but I'm only able to send one receiver and one in CC. Is there any way I can send multiple receivers and CCs in one mailtrigger?

 

Thanks

atiqah

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.