Author Topic: Event Studio not sending out some emails  (Read 5307 times)

Offline mizu

  • Full Member
  • ***
  • Join Date: Jul 2008
  • Posts: 33
  • Forum Citizenship: +0/-0
Event Studio not sending out some emails
« on: 20 Oct 2009 01:32:58 pm »
Hi,

i had a problem with Event Studio not sending out some emails. I wanted to use a data item from a package as the mail address, but whenever it contained more than one mail address, say "address1@mail.com;address2@mail.com", running of agent failed..

After some reading/trying, i found out what the solution was, so I would just like to share it with you. Here it is:

Event Studio provides a possibility to send an email in case, that some predefined condition is met. When we want to use this funcionality, according to the possibilities of adding recipients there are two possible ways to do this - typing in the email recipients manually or inserting them as a data item from a package.

Inserting recipients manually
The first and basic possibility is to insert the recipient manually by typing in his/her mail address, or by clicking the "Select the recipients.." link right under the mail form. This way we can find and insert a user directly from Active Directory. When we want to add multiple recipients, we have to divide them by a semicolon.

Inserting recipients from a package
The second possibility is to insert the recipient as a data item from a package. But. To have Event Studio working properly, the inserted data item can only contain one mail address. This means that if we use a data item, call it [recipient1] for example, which contains a string like "my.address@mailbox.com", everything will work fine. On the other hand, if it contains something like "my.address@mailbox.com;" or "first.address@mailbox.com;second.address@mailbox.com", Event studio will end up with an error and will not be able to send the mail.

Workaround
As far as i know, the only way to fix this is to make changes to the underlying data model. If we assume, that the list of recipients is stored in a database table, we can divide the original column to more columns and fill each one of them only by one mail address (as this was my case, i attached a short script that does the parsing work at the end of this post). This far, we corrected the metadata and according to Event Studio's manual, everything should work. Well, it doesn't and it's because the mail form won't let us to insert more than one data item. Neither to the "To", nor the "Cc", nor the "Bcc" input box.

Simply typing in the data items names won't work, because that far, as none of them was used in the Event Studio agent, they are not recognized by it.. So we have to simply ctrl+click or shift+click all the data items we want to use as mail addresses from the "Insertable objects" panel, hit the little blue arrow to insert them into the "To:" field and click "OK" on the error message window that popped up. Now, we can insert the first recipient, say [recipient01] data item, ad a semicolon after it and then copy paste this string as many times as we need and finally rename/retype the data item names (or we can just type all of them in)..

Troubleshooting
If you have any other problems with sending out emails, the only way to find out what's wrong is to turn on some special logging. This tells you how. Logs will be stored both in "cogserver" and the "crnclient" logfile. The difference is, that the "crnclient" will only contain mail related logs, so it's a bit less confusing as the "cogserver" logfile containing also everything else.

Script parsing the mail addresses
It is a bit dummy, but it works:

Code: [Select]
select * from #pom_emails
declare
@s_emails_all varchar (200)
, @s_email varchar (20)
, @i_emails_found int
, @i_index int
, @i_row_count int

select
@i_row_count = count ( id_row )
, @i_index = 1
from #pom_emails

while @i_index <= @i_row_count
begin
print '----'
print 'row number: ' + convert ( varchar , @i_index )
select @s_emails_all = s_email_all from #pom_emails where id_row = @i_index
select @i_emails_found = 0
while ( PATINDEX ('%;%', @s_emails_all ) <> 0 )
begin
select @s_email = LEFT ( @s_emails_all, patindex ('%;%', @s_emails_all ))     
select @s_emails_all = REPLACE ( @s_emails_all, @s_email, '' )     
select @i_emails_found = @i_emails_found + 1
if @i_emails_found = 1
update #pom_emails set s_email_1 = @s_email where id_row = @i_index
if @i_emails_found = 2
update #pom_emails set s_email_2 = @s_email where id_row = @i_index
if @i_emails_found = 3
update #pom_emails set s_email_3 = @s_email where id_row = @i_index
end
if len ( @s_emails_all ) > 0
begin
if @i_emails_found+1 = 1
update #pom_emails set s_email_1 = @s_emails_all where id_row = @i_index
if @i_emails_found+1 = 2
update #pom_emails set s_email_2 = @s_emails_all where id_row = @i_index
if @i_emails_found+1 = 3
update #pom_emails set s_email_3 = @s_emails_all where id_row = @i_index
if @i_emails_found+1 = 4
update #pom_emails set s_email_4 = @s_emails_all where id_row = @i_index
end
select @i_index = @i_index + 1
end

Offline Bark

  • Community Leader
  • *****
  • Join Date: Nov 2012
  • Posts: 79
  • Forum Citizenship: +7/-0
Re: Event Studio not sending out some emails
« Reply #1 on: 22 Aug 2019 05:07:57 am »
Thanks!!! 11 years later, this information was like gold to me! I spent hours trying to find out why the emails weren't sending and it turns out I was passing two email addresses in one data item.

 



       
Twittear