April 29, 2009 at 6:33 am
I've been asked to investigate the feasibility of enabling our database to process incoming emails - i.e. read the body of the email and update records accordingly. Can anyone point me in the right direction to start looking? A quick tour of Books Online shows me procedures like xp_readmail with notes to avoid using them but no pointers as to what I should be using instead.
Thanks
--
Scott
April 29, 2009 at 8:23 am
SQL Server has a stored procedure called sp_processmail, which you can use. Behind the screens it will call xp_readmail, xp_sendmail etc. For security reasons I usually create a copy of sp_processmail, there I do some extra checks like what's the subject of the incoming mail. I also limit the possible actions and remove the @set_user variable.
Biggest drawback of this procedure is that it only works with SQL Mail (with Mapi profile) and not with Database mail (SMTP).
Hope this helps, for more see http://msdn.microsoft.com/en-us/library/ms189829(SQL.90).aspx
[font="Verdana"]Markus Bohse[/font]
April 29, 2009 at 8:27 am
SQL 2005 isn't really built for that. The features worked so poorly in SQL 2000 (too many security holes, etc.), so they pretty much replaced it in 2005. DBMail works much better for sending mail than xp_sendmail, but there isn't a replacement for handling incoming mail.
I think Microsoft's basic expectation is that you'd use Exchange and Sharepoint to handle that, and then have them connect to the database for whatever was needed there.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
April 29, 2009 at 9:25 am
That's more like the answer I'd expected than the answer I'd hoped for, but thanks.
--
Scott
April 29, 2009 at 9:32 am
this sounds like something perfect for a CTE to do. expose an SMTP dll and read an email account.
Lowell
April 29, 2009 at 9:37 am
Lowell (4/29/2009)
this sounds like something perfect for a CTE to do. expose an SMTP dll and read an email account.
CTE or CLR? I think you mean CLR.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
April 29, 2009 at 9:57 am
doh! CLR is what i meant....I just grabbed a sample project off of codeproject.com to see if it's easy to do...
Lowell
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply