April 5, 2006 at 3:38 pm
hi,
I have the following code:
set @to = 'you@test.com' ---- i have this stmt..........thru debugger i see tht @to has the value 'you@test.com '
How do i remove the trailing white space in this case using RTRIM
Thanks,
Natalie.
April 5, 2006 at 4:29 pm
April 5, 2006 at 4:30 pm
I'm guessing that @to is defined as char(xx), so it will always be xx long. Define it as varchar(xx) and the variable will hold only what you stuff in.
April 5, 2006 at 4:41 pm
Hi,
I had it char..... changed it to varchar - in the debugger it shows fine now.
But then i dont get the email notification.
DECLARE @msg int
DECLARE @to varchar(50)
DECLARE @from varchar(50)
DECLARE @subject varchar(50)
DECLARE @smtpsrvr varchar(50)
DECLARE @body varchar(50)
SET @to = 'you@test.com'
SET @from = --from addr
SET @subject = 'Subject 1'
SET @body = ---body goes here
SET @smtpsrvr = --smtpsrvr
EXEC sp_OACreate 'CDO.Message', @msg OUT
EXEC sp_OASetProperty @msg, 'Configuration.fields("<A href="http://schemas.microsoft.com/cdo/configuration/sendusing".Value','2'">http://schemas.microsoft.com/cdo/configuration/sendusing").Value','2'
EXEC sp_OASetProperty @msg, 'Configuration.fields("<A href="http://schemas.microsoft.com/cdo/configuration/smtpserver".Value'">http://schemas.microsoft.com/cdo/configuration/smtpserver").Value', @smtpsrvr
EXEC sp_OAMethod @msg, 'Configuration.Fields.Update', null
EXEC sp_OASetProperty @msg, 'To', @To
EXEC sp_OASetProperty @msg, 'From', @From
EXEC sp_OASetProperty @msg, 'Subject', @Subject
EXEC sp_OASetProperty @msg, 'TextBody', @Body
EXEC sp_OAMethod @msg, 'Send', NULL
EXEC sp_OADestroy @Msg
April 6, 2006 at 7:03 am
Hello Natalie,
I have checked by executing the code and it is working fine.
Thanks and have a great day!!!
Lucky
April 12, 2006 at 2:56 pm
Hi,
I am still not able to receive the mails - do i have to configure outlook to receive mails from sql server
Let me know.
Thnx.
April 13, 2006 at 8:16 am
No outlook is a mail client and doesn't require any configuration to receive emails.
SQL server on the other hand does require a MAPI profile to be able to send emails.
Have you configured SQL Server ?
April 13, 2006 at 1:16 pm
Have you set @smtpsrvr to a valid mail server address?
Does the mail server allow you to use it to send emails?
If not on the same LAN, is the firewall open to you sending emails?
Tim S
April 13, 2006 at 3:43 pm
Hi,
@smtpsrvr is set to a valid mail server address.
i am able to send mails and receive in general.
I did not have from addr mentioned earlier - but then i was able to execute and i got the mail. But then when i try it again - say by changing the body content - and execute - i am not receiving the mail.
Anyways - will play around with it more.
Thnx
April 13, 2006 at 4:53 pm
I am able to receive the email notifications.
It was just that i didnt have @From in my code....... guess all statements are required for the email notifications to get through
Thnx.
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply