Using smtp_mailer

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?

Thanks in advance.

John.


johnb (BOB member since 2006-07-05)

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.

something like:
$variable=exec(‘cmd’,‘ur exe_with arguments’,‘0’);
print($variable);

or u can execute exe directly with out cmd(suggested cmd as u said working fine with cmd prompt)

o/p should be printed in that case.
Lets Know if it works.


dushyant20022002 :india: (BOB member since 2006-02-01)

No, I haven’t tried it from DI yet - I wanted to get it working from the DOS command line first.

My problem is that I can get smtp_mailer to work from the command line and send me an email but I can’t get it to work with an attachment.

My question is whether anyone has managed to get smtp_mailer working with attachments.

John.


johnb (BOB member since 2006-07-05)

What is the syntax for smtp_mailer to work from within the DI. I am using

exec(‘D:\Program Files\Business Objects\Data Integrator 11.5\Bin\smtp_mailer.exe’, '-r"newemail.link.co.uk" -f"ft@link.co.uk" -t"bt@link.co.uk" -s"bt", ‘0’);

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 .


thakks :uk: (BOB member since 2006-10-24)

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 :smiley:


thakks :uk: (BOB member since 2006-10-24)

heh. Good solution, except alot of us are not using SQL Server as our db. =)

  • Ernie

eepjr24 :us: (BOB member since 2005-09-16)

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.


thakks :uk: (BOB member since 2006-10-24)

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. =)

  • Ernie

eepjr24 :us: (BOB member since 2005-09-16)

Yup i agree with you! It is shame that DI does not have the mailing functionality that the real time project demands :frowning:


thakks :uk: (BOB member since 2006-10-24)