Hi. Does anyone see a problem with the code below? When I execute that code against sqla 12, I see normal execution times, but no email is received. Thanks. call xp_startmail(); |
Do you actually have an email server ready to accept the email you are sending? Is it MAPI or SMTP? (your use of xp_startmail implies "MAPI") Are you using Microsoft Exchange? You probably need to specify a user name. Plus, what Volker said... check the return codes using the Super Funky Form of CALL... DECLARE @return_code INTEGER; @return_code = CALL xp_startmail ( mail_user = @mapi_mail_username, mail_password = @mapi_mail_password ); IF @return_code <> 0 THEN ...something bad happened And when none of that works, switch to SMTP and use Google's server :)... Breck, we are having better luck with SMTP, however, our app must offer both SMTP and MAPI. Based on your example, I tried this code from ISQL... BEGIN DECLARE @return_code INTEGER; @return_code = CALL xp_startmail(mail_user = 'doug.stone@apihealthcare.com'); MESSAGE @return_code TO CLIENT ; END ... which generated an Error 5. A few years ago, when we first placed the MAPI/SMTP capability into the app, all was fine. However, that may have been before our email was connected to Microsoft Exchange. Any thoughts/suggestions?
(11 Apr '14, 10:26)
dejstone
Replies hidden
1
AFAIK, several years ago Micosoft introduced a feature to disallow programs to send mail via MAPI automatically (i.e. without explicit user confirmation). May that apply here?
(11 Apr '14, 11:17)
Volker Barth
Are you sure any of your clients can use MAPI to send emails from within ANY executable program? Are you sure any of your clients CARE? FYI Microsoft doesn't want you to use xp_startmail or ANY of the related xp-email-thingies in SQL Server. See xp_startmail (Transact-SQL): "This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature." If you still want to proceed with MAPI, please start a new question specifically related to the error code returned by xp_startmail().
(11 Apr '14, 11:58)
Breck Carter
(13 Apr '14, 13:49)
dejstone
|
You should check the return code of these procedures...