sp_On_Email_In

sp_On_Email_In

sp_On_Email_In is triggered after a new incoming e-mail message has been received.

Remarks

This procedure should not be called directly by developer, it is automatically called by Boomerang services after completion of a job. This handler is invoked by Boomerang services both in event of success and failure.

Default body of this procedure is blank, thus user may provide their own code implementation for follow-up purposes.

Any changes to handler parameter list cannot be made. New parameters may add with future Boomerang releases upon which a notice will be sent separately.

Syntax

exec sp_On_Email_In @rKey=...

Parameters

Column Name Data type Direction Description Default Status
@rKey uniqueidentifier in Message key rKey found in IN_EMAIL table Required

Return Code Values

0 (success) or non-zero (failure)

Examples

Process incoming email to a specific recipient

---------- Customer service -------------
 
declare @jKey uniqueidentifier 
declare @From_Email varchar(255)
 
select   @jKey= t1.jKey, @From_Email=From_Email 
from
dbo.IN_EMAIL t1 inner join dbo.IN_EMAIL_RECIPIENT t2 on t1.rKey=t2.rKey
where (t1.rKey=@rKey) and (t2.Email = 'Customer_Service_Department@fuel9.com')
 
if @@rowcount=1 
begin
	--
   --If reply store message in CRM database under specific account
   if  @jKey is not null 
   begin 
   exec sp_Process_Incoming_Replies @rKey=@rKey
   end 
   -- If not reply notify the senders account manger 
   if @jKey is null
   begin
   exec sp_Notify_Account_Manager @rKey=@rKey, @Sender=@From_Email 
   end
 
end

See Also

Helpers
IN_EMAIL
IN_EMAIL_CONTENT
IN_EMAIL_RECIPIENT
IN_EMAIL_HEADER
Configuring Email In – SMTP Forwarding