Using xp_sendmail To Attach File To E-Mail NOT Place In Body Of E-Mail -
10-27-2010
, 05:39 PM
To Whom It May Concern:
I REALLY, REALLY, REALLY hope someone can help me with this... It'll
help immensely.
I'm running on SQLAnywhere 11.0.1. I have a SQL script that calls a
stored procedure that contains a CALL to xp_sendmail that sends
colleagues an e-mail every time a we run a process for one of our
clients. I'm DYING to get this call to actually attach a Word DOC
file to the e-mail itself INSTEAD of placing it in the body of the e-
mail.
For example, here's a snapshot of what's at the bottom of the body of
the e-mail that's getting sent:
--==_EMAIL_MIME_2010_1027_175038_==
Content-Type: application/octet-stream; name="ye_load_approval.doc"
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="ye_load_approval.doc"
0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/
CQAGAAAAAAAAAAAAAAABAAAASAAAAAAAAAAA
EAAASgAAAAEAAAD+////
AAAAAEcAAAD/////////////////////////////////////////////
....
....
....
Here's what my call to xp_sendmail looks like, very simple:
CALL xp_sendmail(include_file='D:\\ye_load_approval.doc ',
recipient=to_list,
subject=subjectdata,
"message"=bodydata);
Mind you, to_list, subjectdata and bodydata are variables in my stored
procedure so the contents of the e-mail can be dynamic, so no worries
there.
I am also using xp_startsmtp and xp_stopsmtp.
Now, I see that the documentation states:
"Attachments specified by the include_file parameter are sent as
application/octet-stream MIME type, with base64 encoding, and must be
present on the database server."
Is there anyway I can get this to not appear in the e-mail body and
get it to be a true attachment?
I see there's lots of other options in xp_sendmail (i.e., attachname,
attach_result, etc...) via Transact-SQL, which I don't know much about
nor do I know if I can take advantage of them?
Any help would be appreciated. Thanks!
Sincerely,
Anthony Mangione
amangione (AT) jatsoftware (DOT) com |