Four Stars

Invalid email adress in tsendmail

Hi,
i have a problem with wrong email adress in tsendmail. I test my procedure with to rows in the database, one with a wrong email. When i run the job, i get this message :
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 <ERR-C1> Unknown recipient
My question is how to get information on the wrong email to update it in the database.
Thanks for your help.
Raphaël
6 REPLIES
One Star mpa
One Star

Re: Invalid email adress in tsendmail

rlaurent,

Add the following after your tSendMail:
tFixedflowInput --> tLogrow ( or to a table/file which is needed)
Connect the tSendmail with the tFixedflowinput using an OnComponentError link.
In the tFixedflowInput you create a schema with 1 column (or more if u want) and generate 1 row.
For the value use the key parameter from your tFlowToIterate. (just like u used in tSendmail)
I think it should work like this.
Regards
Four Stars

Re: Invalid email adress in tsendmail

Hi MPA,
Thank you for your proposition, but it doesn't work.
The component as no error, I guess the error message comes from the SMTP server. As you can see in the picture above the process ends without any error (exit code=0).
My concerne is :
how to prevent from wrong email
or
how to test the email adress before sending the email
or
How to catch the exception message and connect it to the email adress.
I try the last solution using the Tlogcatcher catching the java exceptions, but without any result at the moment.
Thanks for your help
Raphaël
One Star mpa
One Star

Re: Invalid email adress in tsendmail

rlaurent,
If the component indeed does not give an error but just a warning it won't work.
Maybe you could try filtering the emailadresses and do some basic checks for the format, for example does the emailadress looks like "%@%.%".
Regards
One Star

Re: Invalid email adress in tsendmail

Hi,
You can use a tExtractRegexFields with some statements like "(*)@(*).(*)" to filter the valid email addresses and Rejected rows can be sent to different flow, may be a log file or database store, for updation later
--
Regards,
Vinod
Four Stars

Re: Invalid email adress in tsendmail

hi,
thank you for your responses. I try those solutions, but it's only a part of the problem. The email that return a error message from the SMTP server has a good syntax, but doesn't exist.
Regards,
Raphaël
Community Manager

Re: Invalid email adress in tsendmail

Hi
Move tSendMail to a child job, check the option 'die on error' on tSendMail, so that the child job will die once the email adrees is invalid or does't exist, output the current email address to a file or a database. The job design as below:
parent job:
...other part of job--main--tFlowToIterate--iterate--tRunJob
on tRubJob: call the childjob and pass the current email address to child job, uncheck the option 'die on error', so that the job will continue to process next email adress even though child job fails on last email address.
child job:
tSendMail
|
onsubjoberror
|
tFixedFlowInput--main--file or DB component
on tFixedFlowInput: generate the current email address.
About how to pass a value from parent to child job, see
http://www.talendforge.org/forum/viewtopic.php?id=1654
----------------------------------------------------------
Talend | Data Agility for Modern Business