Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 7th, 2006, 12:34 AM
Authorized User
 
Join Date: Aug 2003
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem sending an email

Hello,

I have a stored proc that fetches records and emails them.
Inside this stored proc I call another stored proc: "getMailContent"
which has an out parameter @content

Sp_GetMailcontent @ReminderName,@ReminderDate,@dy,@Footer,@content output

Problem:

Inside Sp_GetMailcontent, @content has a hard code(fixed) text as well as a dynamic variable @footer which is appended to it.
The footer itsef is 7500 chars long and @content exceeds 9000 chars.

In the parent Storede Proc the @content is passed in another Stored Proc used to email this content.

sp_SendEmails @fromemail',@toemail,@subject,@content

How to send the complete email content in the email procedure, as it itself is limited by a 8000 chars ?
I get a stripped down email.

Regards,

Vinay
 
Old February 7th, 2006, 09:38 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 146
Thanks: 0
Thanked 1 Time in 1 Post
Default

Vinay

It would be helpful to know what is your underlying procedure for sending email, xp_sendmail (which uses MAPI) and requires Outlook to be installed on the server, or is it the extended stored proc create by Gert Draper that just allows you to send directly through SMTP?

Finding or writing a better xp would be one way. For now I will assume you are using xp_sendmail

Two approaches
1) Write your message to a file and attach it to the email
xp_sendmail @recipients = '[email protected] '
    ,@message = 'See attached file' -- limited to 8000
    ,@attachments = 'c:\MyMessage.txt' -- no limit
    ,@subject = 'subject'

2) Send your message as a query (either in the body or as an attachment)
xp_sendmail @recipients = '[email protected]'
    ,@query = 'SELECT Header + Message + Footer FROM EmailMessages' -- Table you create where you store your info
    ,@subject = 'subject'
    ,@attach_results = 'true'


David Lundell
Principal Consultant and Trainer
www.mutuallybeneficial.com
 
Old February 16th, 2006, 05:10 AM
Authorized User
 
Join Date: Aug 2003
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi David,

Thanks for the information. I am using the Stored Proc that sends directly through smtp; i.e using "sp_OASetProperty" and "sp_OAMethod".

Can I send attachments also using these ?

Thanks in advance.

Vinay

 
Old July 23rd, 2006, 12:55 PM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 146
Thanks: 0
Thanked 1 Time in 1 Post
Default

Yes you can, if it was implemented in the Stored Proc. However, stored procs that call sp_OA procs are going to be far less efficient than an XP where you make one call to it.
Take a look at http://www.sqldev.net/xp/xpsmtp.htm
You don't need outlook. You can send right to an SMTP server

David Lundell
Principal Consultant and Trainer
www.mutuallybeneficial.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Email Sending Problem dharmeshtandel Forum and Wrox.com Feedback 1 April 30th, 2008 08:46 AM
Email sending problem [email protected] ASP.NET 1.0 and 1.1 Basics 3 December 21st, 2006 01:16 PM
Problem with Sending Email rama26 Pro JSP 0 April 22nd, 2006 01:50 AM
Email Sending Problem.. gaurav_jain2403 VB.NET 2002/2003 Basics 2 February 4th, 2006 09:08 AM
sending email problem maitias C# 1 February 3rd, 2006 01:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.