microsoft.public.sqlserver.notificationsvcs
[Top] [All Lists]

Re: mail subject and from email address

Subject: Re: mail subject and from email address
From: Phaitour
Date: Wed, 17 May 2006 16:58:02 -0700
Newsgroups: microsoft.public.sqlserver.notificationsvcs
Hi Ramadu,

It's still a bit unclear.  

What is this dbo.[NotificationClassName]Notify() function that you're 
refering to.  When is it called?  Who calls it?  What can I do to modify it?  
Where should I call it from?  

Thanks in advance for your help!

T

"ramadu" wrote:

> Hi Phaitour,
> 
> My initial reply was based on your requirement to have the list of 
> OrderNum as part of the subject. If you need the subject to have the 
> number of messages, you can have one more field in the notification 
> class called OrderCount. When you populate this field, while calling the 
> dbo.[NotificationClassName]Notify() function in your SQL statement you 
> can put in the count() of the number of rows being selected.
> 
> Now, in the subject field you can format it as "You have " + OrderCount 
> + " message(s)."
> 
> I hope this satisfies your requirement.
> 
> - ramadu
> 
> :
> > Thank you Ramadu for your reply!  I'm stil a bit unsure as to how to make 
> > the 
> > subject string dynamic.  Let me elaborate:
> > 
> > In the system I have two notifications (both for [email protected]), but I 
> > turned on digesting so the system will mail out both notificiations within 
> > the same email.  Now, the subject for a normal email might say, "you have a 
> > message!"; but in this case, because there are two nofications contained 
> > within the same email, I want the email to say "you have 2 messages!" or 
> > perhaps "you have multiple messages".
> > 
> > Is there a way to make the subject line of the email dynamic that way?
> > 
> > "ramadu" wrote:
> > 
> >> Hi Phaitour,
> >>
> >> Is OrderNum a field name in your NotificationClass? In that case, when 
> >> you call the dbo.[NotificationClassName]Notify() function you can add 
> >> all the OrderNum from your EventClass into one single string using SQL 
> >> and then pass into the function. When you have multiple notification 
> >> nodes for delivery, I don't believe SSNS will add the OrderNum fields 
> >> into a single string.
> >>
> >> To answer your second question, you can set the SQLExpression for the 
> >>  From FieldName as follows:
> >>
> >> <SqlExpression>'Phaitour 
> >> <[email protected]>'</SqlExpression>
> >>
> >> If you are going to use the Windows 2000/XP SMTP service to deliver your 
> >> emails, you have to specify an email address in a valid format.
> >>
> >> Hope that helps!
> >>
> >> - ramadu
> >>
> >> http://sriramvenkataramani.tripod.com/
> >>
> >> :
> >>> Hi Joe, Shyam, and kate,
> >>>
> >>> I've been a long time reader of your works and it's helped me through 
> >>> quite 
> >>> a few tough spots, but I still have a couple of questions for you guys :P
> >>>
> >>> 1) What happens in digest delivery mode when you do something like:
> >>>                                   <FieldName>Subject</FieldName>
> >>>                                   <SqlExpression>'Order# ' + OrderNum + ' 
> >>>  has been processed'</SqlExpression>
> >>>
> >>> I'm interested because I want to put in a dynamic subject based on 
> >>> whether 
> >>> or not the notification is going to be a digest.  There will be times 
> >>> when 
> >>> the email is for a single notification and thus the subject should be 
> >>> singular, and times when the notification is actually a digest of 
> >>> multiple 
> >>> event matches and thus the subject should be plural...  Is there an easy 
> >>> way 
> >>> to do this?
> >>>
> >>> 2) Is there a way to specify a "display name" for the sender email 
> >>> address 
> >>> within the built in SMTP delivery protocol?  What I mean is: it's 
> >>> straight 
> >>> forward to send out an email from any email address, but that will show 
> >>> up at 
> >>> the recepients inbox as coming from that email address; is there a way to 
> >>> specify the "alias" for that from email address so in the inbox the user 
> >>> sees 
> >>> a phrase or other text instead of the email address?
> >>>
> >>> Thanks in advance to all who can help!!
> >>>
> >>> T
> >>>
> >>> "Joe Webb" wrote:
> >>>
> >>>> Sure. You can add a field to the subject of the email by referencing any 
> >>>> field that's being passed to the protocol.  Care should be taken, 
> >>>> however, if you're using the digest delivery option.
> >>>>
> >>>> See the following example:
> >>>>
> >>>> <Protocols>
> >>>>          <Protocol>
> >>>>                  <ProtocolName>SMTP</ProtocolName>
> >>>>                  <Fields>
> >>>>                          <Field>
> >>>>                                  <FieldName>Subject</FieldName>
> >>>>                                  <SqlExpression>'Order# ' + OrderNum + ' 
> >>>> has been processed'</SqlExpression>
> >>>>                          </Field>
> >>>>                          <Field>
> >>>>                                  <FieldName>BodyFormat</FieldName>
> >>>>                                  <SqlExpression>'html'</SqlExpression>
> >>>>                          </Field>
> >>>>                          <Field>
> >>>>                                  <FieldName>From</FieldName>
> >>>>  
> >>>> <SqlExpression>'[email protected]'</SqlExpression>
> >>>>                          </Field>
> >>>>                          <Field>
> >>>>                                  <FieldName>Priority</FieldName>
> >>>>                                  <SqlExpression>'Normal'</SqlExpression>
> >>>>                          </Field>
> >>>>                          <Field>
> >>>>                                  <FieldName>To</FieldName>
> >>>>  
> >>>> <SqlExpression>DeviceAddress</SqlExpression>
> >>>>                          </Field>
> >>>>                  </Fields>
> >>>>          </Protocol>
> >>>> </Protocols>
> >>>>
> >>>>
> >>>> HTH...
> >>>> Joe Webb
> >>>> SQL Server MVP
> >>>>
> >>>> ~~~
> >>>> Get up to speed quickly with SQLNS
> >>>> http://www.amazon.com/exec/obidos/tg/detail/-/0972688811
> >>>>
> >>>>
> >>>>
> >>>> Mostafa Salama wrote:
> >>>>> can i change the mail suibject according to the data in the 
> >>>>> notification table
> >>>>>
> >>>>> <NotificationClass>
> >>>>> <NotificationClassName>InstantMessageEmailNotifications</NotificationClassName>
> >>>>> <Schema>
> >>>>> <Fields>
> >>>>> <Field>
> >>>>>   <FieldName>MessageBody</FieldName>
> >>>>>   <FieldType>nvarchar(4000)</FieldType>
> >>>>> </Field>
> >>>>> <Field>
> >>>>>   <FieldName>Description</FieldName>
> >>>>>   <FieldType>nvarchar(500)</FieldType>
> >>>>> </Field>
> >>>>> </Fields>
> >>>>> </Schema>
> >>>>> <Protocols>
> >>>>>  <Protocol>
> >>>>>  <ProtocolName>SMTP</ProtocolName>
> >>>>> <Fields>
> >>>>>  <Field>
> >>>>>  <FieldName>Subject</FieldName>
> >>>>>  <SqlExpression>Description</SqlExpression>??????????
> >>>>> </Field>
> >>>>> <Field>
> >>>>>  <FieldName>BodyFormat</FieldName>
> >>>>>  <SqlExpression>&apos;html&apos;</SqlExpression>
> >>>>> </Field>
> >>>>>
> >>>>> ?????????can i do that?!
> >>>>> how can be subject 
> 

<Prev in Thread] Current Thread [Next in Thread>