Need to pass 'from' and 'to' mail addresses as arguments

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Need to pass 'from' and 'to' mail addresses as arguments

Post by pandeesh »

I need to pass the from and to mail addresses as arguments for routine.
So how i need to modify DSSendMail part to accomplish this?

Code: Select all


......

FromID=Arg2
ToList=Arg3

..........

Mail = DSSendMail("From:"FromID"\nTo:"ToList"\nServer:b01\nSubject:\nBody:Please find the log":vEventDetail ) 

......................



I am passing the below arguments:


Arg2=abc@xyz.com

Arg3=abc@tyty.com,gahghg@nhy.com


But it's not working and returning -21.


It's simply Passing FromId and ToList but not the actual values.

Please help me to pass the From and To addresses as parameters.

Thansk
pandeeswaran
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

It looks like your DSSendMail string is missing the concatenate colons surrounding your parameters. Have you tried "From:" : FromID : "\nTo:" : ToList : "\n ... etc. ?

Another thought is that it may be time to start a new topic on this matter.
Choose a job you love, and you will never have to work a day in your life. - Confucius
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I agree. :wink:

And Eric is absolutely correct as to your issue. The way you have them now they just get passed in as strings rather than being resolved as parameters.
-craig

"You can never have too many knives" -- Logan Nine Fingers
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Re: Need to pass 'from' and 'to' mail addresses as arguments

Post by SURA »

Arg3='abc@tyty.com gahghg@nhy.com'

In the instead of , use space may be the reason.

DS User
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Thanks for everyone!

It's working now.

I have noticed one more thing.

The recipients list should be passed as space delimited as SURA mentioned.

But i am passing the ToList as comma delimited.

So i have converted those to space delimited using the below code:

Code: Select all


ToList=Convert(",",' ',Arg3)

then i have passed ToList to DSSendMail and that worked fine.

Just out of curious i have tried the below code too:

Code: Select all


ToList=Convert(","," ",Arg3)

But eventhough the routine returns 0 , the mail was not sent.

I feel both should work fine.

What's the difference betwen both?

Thanks
pandeeswaran
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

There is no difference.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply