cancel
Showing results for 
Search instead for 
Did you mean: 

Lookup table and send email

ximen
Participant
0 Kudos
2,786
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

Accepted Solutions (0)

Answers (2)

Answers (2)

VolkerBarth
Contributor

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.

ximen
Participant
0 Kudos

Can you help me to modify under my SQL

Former Member
0 Kudos

Try This:

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