Attachment using xp_sendmail

  • Hi ,

    Could you please tell me the process where in i will be able to send an attachment using xp_sendmail.

    Thanks

    Suresh

     

  • Search for "xp_sendmail" in books online and it will give you the list of parameters.  The @attachments parameter can be set to create an email attachment.

     

    Hope this helps!

  • Hi Guys,

    Thanks for the reply.

    I have tried all the ways.Even though i pass the parameter for the attachment the xp_sendmail procedure works well to send the mail,but without any attachement in that.So what are the things i need to consider if i need to send an attachment using this stored procedure.If you can brief about this i would be greatful

     

    Thanks

    Suresh

     

  • Sounds simple, but have you checked the path?  I just ran a quick test with the following syntax, and it seems to work fine.  Are you getting any errors?:

     

    exec master..xp_sendmail @recipients = 'bgates@microsoft.com', @subject = 'test', @attachments = '\\mypath\myfile.txt'

  • Hi Rookie,

    Thanks a lot for your help , i wasnt trying the way you said.Well the help menu of sqlserver is that reliable with no good examples on that.Well i will give it a shot.Could you please give me your hotmail id or yahoo id so that i can talk to you on much on datawarehousing.Thanks a lot again              

    Cheers!!!!!!

    Suresh

          

     

     

  • Hi ,

    I tried sending the mail with an attachment and it gave an error xp_sendmail failed with a mail error 0x80004005.

    But when i send the mail without an attachment it works well.

    Please let m know on this

    Thanks

    Suresh

     

  • I have had a similar message before.  I would try the following:

     

    xp_stopmail

    xp_startmail

     

    And see if that works.  If not, I would be interested to see if anyone else has experienced this mail error and what cause/solution they may have.

     

  • Hi Rookie,

    Do u mean to say that i need to begin with

    xp_stopmail

    xp_startmail

    and later the execute statement that you said

    Thanks

    Suresh

  • Hi Rookie,

    I dont have the permission to stop the procedure or start the procedure as i am working on the terminals that are setup in canada.Is there any other that you can think of to execute the process

    Thanks

    Suresh

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply