I want to send and email with an attachment and I understand that this can be done using the smtp_mailer.exe program.
The command I am using is
smtp_mailer.exe -rsmtpsrvr -fsender@blahbla.com -tmyaddress@mycompany.com -s"Subject Line For The Email" -email.txt -aFileToBeAttached.txt
where
[list]
“smtpsrvr” is the name of the smtp server
“email.txt” holds the body of the email
“FileToBeAttached.txt” is the file I want to attach to the email.
[/list]
I can get it to work from the DOS command line but the attachments are not coming through on the emails. I have tried quoting the file name and using directory/file name but nothing seems to work.
Interestingly if I use an invalid file name for the -m parameter then the program fails bit if I use an invalid file name for the -a param it carries on regardless.
Has anyone managed to get smtp_mailer working with attachments?
Are u executing the function using exec in DI?
you can execute the function using exec() and send it to cmd prompt to execute.get the o/p in a variable and print it.
This would print the op of the command after execution.
IF the above syntax is not correct please help as i am struggling make it work from within DI. I tried through cmd but it looks that i have to do some changes within my reg file to make it work as it says here http://office.microsoft.com/en-gb/assistance/HA011364471033.aspx .
Ok guys this is what i did to send mail from within DI
sql (‘DS_Misdatabase’,‘master.dbo.xp_sendmail @recipients=N’bt@link.co.uk’,@message=N’Your message’,@query=N’select * from your table’,@attach_results = ‘TRUE’,@width = 250,@subject=N’Testing mail from DI’;’);
I used the sql extended stored procedure, which is xp_sendmail. Also if you have database mail configure on your server that comes with SQL2005, then use this stored procedure sp_send_dbmail. The second one uses smtp connection and do not need outlook or mapi to be setup on the server
thats true but i understand that if MICROSOFT provide such stored procedure i am sure most of the other database available in the market might be having some kind of similar stored procedure.
Ah, sorry. Did not make my point clear, I guess. It is much easier (and more standard) to have your ETL tool handle the mailing for several reasons. First, you may operate in more than one DB / OS environment. Second, your mailing scripts can be easily standardized and maitained within one environment. Third, some DB systems do not provide easy to use SMTP functionality (I think Sybase requires a plug in, not sure about postgre or mysql, DB2 does not have one within the DB itself on certain platforms).
Lastly, if DI puts the functionality there, it should work. =)