Home > Archive > MS SQL Server > October 2005 > smtp SendMail routine









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author smtp SendMail routine
Jim Muir

2005-10-31, 1:23 pm

I am using an smtp routine that uses CDO to send an email message from a
trigger when a record is added. The question this newbie has is this:

using 'text/plain'


<<Message text>>
Name: Firstname M. Lastname CaseNo : 200512345 Counselor : XYZ Group:
ABC AdmitDate : Oct 28 2005

<<end Message text>>


What I am trying to get is a formatted message that looks like this:

<<Message text>>

Name: Firstname M. Lastname
CaseNo : 200512345
Counselor : XYZ
Group: ABC
AdmitDate : Oct 28 2005

<<end Message text>>


This is the trigger code that sends the message....

CREATE TRIGGER NotifyStaffOfAdmissi
on ON [dbo].[ADSRoster]
FOR INSERT
AS
Declare @queryresult varchar(8000)
Set @queryresult = (SELECT ' Name: ' + NAME +Char(10)+Char(13)+ '
CaseNo : ' + CASENO +Char(10)+Char(13)+ ' Counselor : ' + COUNSELOR
+Char(10)+Char(13)+ ' Group: ' + [GROUP] +Char(10)+Char(13)+ '
AdmitDate : ' + CAST(ADMITDATE AS nchar(11)) AS Note FROM Inserted)


EXEC dbo.sp_sendSMTPmail
@To='jpmuir@xyz.org;LarryS@xyz.org',
@Subject='New Client',
@Body= @queryresult,
@Cc='',
@Bcc='',
@Attachments='',
@HTMLFormat=1,
@From='IBHCensus@XYZ
.org'

I thought the char(10) and char(13) linefeeds and carriage returns would
fly but Outlook either strips them or they die another death in between.

Any insight to how I can get this going? Is Plain text the problem?
(perhaps I need to use Html?)

Jim M.
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com