Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-03-28 : 08:15:44
|
| Jayakumar writes "/*********************** CodeCREATE Procedure sp_SendMail @SenderName varchar(100), @SenderAddress varchar(100), @RecipientName varchar(100), @RecipientAddress varchar(100), @Subject varchar(200), @Body varchar(8000), @MailServer varchar(100) = 'localhost' AS SET nocount ondeclare @oMail int --Object referencedeclare @resultcode intEXEC @resultcode = sp_OACreate 'SMTPsvg.Mailer', @oMail OUTif @resultcode = 0BEGINEXEC @resultcode = sp_OASetProperty @oMail, 'RemoteHost', @mailserverEXEC @resultcode = sp_OASetProperty @oMail, 'FromName', @SenderNameEXEC @resultcode = sp_OASetProperty @oMail, 'FromAddress', @SenderAddressEXEC @resultcode = sp_OAMethod @oMail, 'AddRecipient', NULL, @RecipientName, @RecipientAddressEXEC @resultcode = sp_OASetProperty @oMail, 'Subject', @SubjectEXEC @resultcode = sp_OASetProperty @oMail, 'BodyText', @BodyEXEC @resultcode = sp_OAMethod @oMail, 'SendMail', NULLEXEC sp_OADestroy @oMailEND SET nocount offGO***********///////////////////////////I had a problem with MAPI, so I looked into your code I find it so simple. I use Argosoft Mail server 127.0.0.1 as default IP Address. when I send the mail from Query Analyzer using the command provided in the code, Command Executed successfully, but I haven't received any mail. What do i have for the MailServer='localhost' in the procedure ? when I use the Argo software. Are there any other configurations that need to be done. Will you please help me out in solving the problem ASAP. Thanks, Jay Kumar." |
|
|
|
|
|
|
|