Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 7th, 2006, 12:34 AM
Authorized User
 
Join Date: Aug 2003
Location: , , India.
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
Reply With Quote
  #2 (permalink)  
Old February 7th, 2006, 09:38 AM
Friend of Wrox
 
Join Date: Dec 2005
Location: , AZ, .
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 = 'recipients@theirdomain.com '
    ,@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 = 'recipients@theirdomain.com'
    ,@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
Reply With Quote
  #3 (permalink)  
Old February 16th, 2006, 05:10 AM
Authorized User
 
Join Date: Aug 2003
Location: , , India.
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

Reply With Quote
  #4 (permalink)  
Old July 23rd, 2006, 12:55 PM
Friend of Wrox
 
Join Date: Dec 2005
Location: , AZ, .
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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 aneesh_sunu@yahoo.co.in 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



All times are GMT -4. The time now is 03:38 PM.


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