BEGIN 
DECLARE content LONG VARCHAR;
set content='select * from shipper';
CALL xp_startsmtp( smtp_sender = 'mfkpie8@163.com', smtp_server='smtp.163.com', smtp_port='25',
timeout=240, smtp_auth_username='mfkpie8', smtp_auth_password='password');
CALL xp_sendmail( recipient='131t@qq.com',
      subject='ssssssss',"message"=content,query='select * from shipper');
call xp_stopmail();
end

question: But did not receive my email, just received ‘select * from shipper',Don't have any data

asked 21 Nov '13, 04:42

mfkpie8's gravatar image

mfkpie8
86424751
accept rate: 10%

edited 21 Nov '13, 04:42


This is expected behaviour - confine the docs on the query parameter:

query
This LONG VARCHAR is provided for Transact-SQL compatibility. It is not used by SQL Anywhere. The default is NULL.

So I guess you will have to either

  • output your query result to a file (via the UNLOAD statement) and attach that file to your mail or
  • output your query result to a variable and add that variable's contents to the "message" parameter.

The cited doc page shows some samples on the usage.

permanent link

answered 21 Nov '13, 05:06

Volker%20Barth's gravatar image

Volker Barth
30.3k300452659
accept rate: 32%

edited 21 Nov '13, 05:07

Can you help me to modify under my SQL

(21 Nov '13, 05:24) mfkpie8

Try This:

CALL xp_sendmail( recipient='Sales Group', subject='New Pricing', include_file = 'C:\DOCS\PRICES.DOC' );

permanent link

answered 21 Nov '13, 05:17

Adiel's gravatar image

Adiel
1335
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×10
×9

question asked: 21 Nov '13, 04:42

question was seen: 585 times

last updated: 21 Nov '13, 05:24