Formatting of the mail body text in SMTP adapter

Damir Dobric Posts

Next talks:

 

Damir@Phone    

Follow me on Twitter: #ddobric



 

 

Archives



Imagine, in your scenario, there is a XML-message which has to be loaded by some receive port. Depending on attributes in the message it is required to send an email to some recipient. To do that, create the orchestration as shown at the picture bellow:

 

Note that both messages PacErrorMessage and EMailErrorReportMessage are of type XmlDocument.
The orchestration shown at the picture contains the ConstructMessage Shape of assignment type which is responsible to construct the message which will be sent per email.

Following code is contained in the corresponding expression shape (which is inside of ConstructMessage shape): 

EMailErrorReportMessage = PacErrorMessage;
EMailErrorReportMessage(SMTP.EmailBodyText) =
System.String.Format("An Error has occured on the PAC server {0} for mandand {1} and login {2}.
Following error has been detected: '{3}'. Following action required: '{4}'",
PacErrorMessage.Config.PacServer, PacErrorMessage.Config.Mandant, PacErrorMessage.Config.Login, PacErrorMessage.Meldung.Fehlermeldung, PacErrorMessage.Meldung.Aktion);


First line of code assignees the whole input message (PacErrorMessage) to the output message (EMailErrorReportMessage).
The second line of code formats and injects the email body text in the output message.This is the example of the output message read from the mail:

An Error has occured on the PAC server 10.100.19.191 for mandand edsgfsger and loginh upa. Following error has been detected: 'Windows-Socket-Fehler: Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenstelle nach einer bestimmten Zeitspanne nicht ordnungsgemäß reagiert hat, oder die hergestellte Verbindung war fehlerhaft, da der verbundene Host nicht reagiert hat (10060), auf API 'connect''. Following action required: 'Export Standardtaetigkeiten'

At this point one thing is interesting. To make this example more simple, the output message could be of type System.String. In that case the code in the exapression shape would look like shown bellow:

EMailErrorReportMessage =
System.String.Format("An Error has occured on the PAC server {0} for mandand {1} and loginh {2}. Following error has been detected: '{3}'. Following action required: '{4}'",
PacErrorMessage.Config.PacServer, PacErrorMessage.Config.Mandant, PacErrorMessage.Config.Login, PacErrorMessage.Meldung.Fehlermeldung, PacErrorMessage.Meldung.Aktion);


ThiS will also work fine, but the message in the body of the mai, will be placed in the XML tags as shown bellow:

<?xml version="1.0"?>
<string>An Error has occured on the PAC server 10.100.19.191 for mandand edsgfsger and loginh upa.
Following error has been detected: 'Windows-Socket-Fehler: Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenstelle nach einer bestimmten Zeitspanne nicht ordnungsgemäß reagiert hat, oder die hergestellte Verbindung war fehlerhaft, da der verbundene Host nicht reagiert hat (10060), auf API 'connect''. Following action required: 'Export Standardtaetigkeiten'</string>


Posted Dec 06 2006, 05:15 PM by Damir Dobric

Comments

amputee fucking sex wrote re: Formatting of the mail body text in SMTP adapter
on 06-24-2008 23:37

hi guy, www.freewebtown.com/.../circumcised-sex.html circumcised sex,  089043,

cis wrote re: Formatting of the mail body text in SMTP adapter
on 08-18-2009 9:08

Thanks!

developers.de is a .Net Community Blog powered by daenet GmbH.