Error in tmailsend

One Star

Error in tmailsend

Dears,
I am getting this below error when i use component tsendmail in my job, without this component my job is running successfully. Can anyone help me in this regard.
Regards,
Ram
Error:

Starting job J_REP_EN at 14:05 20/03/2009.
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Syntax error on token "(", Expression expected after this token
Syntax error on token "(", Expression expected after this token
Syntax error on token "(", Expression expected after this token
Syntax error on token "(", Expression expected after this token
Syntax error on token "Support", invalid AssignmentOperator
at intel_support_sites.j_rep_en_0_1.J_REP_EN.tOracleInput_4Process(J_REP_EN.java:6149)
at intel_support_sites.j_rep_en_0_1.J_REP_EN.runJobInTOS(J_REP_EN.java:11122)
at intel_support_sites.j_rep_en_0_1.J_REP_EN.main(J_REP_EN.java:10953)
Job J_REP_EN ended at 14:05 20/03/2009.
Community Manager

Re: Error in tmailsend

Hello Ram
There is a compilation error in code, go to the 'Code' tab and you will see what's the error.

Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Error in tmailsend

hello
I have the exact same error while using tSendMail in TOS 3.0.2
the same component is working fine on TOS 2.3.3 with same arguments
isn't there a bug with this tSendmail component in TOS 3.0.2 ?
Starting job Prepa_GASPAR at 11:11 28/05/2009.
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Syntax error on token "(", Expression expected after this token
Syntax error on token "(", Expression expected after this token
Syntax error on token "(", Expression expected after this token
Syntax error on token "(", Expression expected after this token
at edifice_gaspar.prepa_gaspar_0_1.Prepa_GASPAR.tSendMail_2Process(Prepa_GASPAR.java:2217)
at edifice_gaspar.prepa_gaspar_0_1.Prepa_GASPAR.tMSSqlInput_1Process(Prepa_GASPAR.java:1987)
at edifice_gaspar.prepa_gaspar_0_1.Prepa_GASPAR.tFileCopy_1Process(Prepa_GASPAR.java:372)
at edifice_gaspar.prepa_gaspar_0_1.Prepa_GASPAR.runJobInTOS(Prepa_GASPAR.java:3085)
at edifice_gaspar.prepa_gaspar_0_1.Prepa_GASPAR.main(Prepa_GASPAR.java:2974)
Job Prepa_GASPAR ended at 11:11 28/05/2009.
code is :
start
*/

currentComponent="tSendMail_2";

String message_tSendMail_2 = (("Hello")==null || "".equals("Hello"))?"\"\""Smiley Sad"Hello") ;
java.util.Properties props_tSendMail_2 = System.getProperties();
props_tSendMail_2.put("mail.smtp.host", smtpHost_tSendMail_2);
props_tSendMail_2.put("mail.smtp.port", smtpPort_tSendMail_2);

props_tSendMail_2.put("mail.smtp.auth", "false");
javax.mail.Session session_tSendMail_2 = javax.mail.Session.getInstance(props_tSendMail_2, null);
javax.mail.Message msg_tSendMail_2 = new javax.mail.internet.MimeMessage(session_tSendMail_2);
msg_tSendMail_2.setFrom(new javax.mail.internet.InternetAddress(from_tSendMail_2));
msg_tSendMail_2.setRecipients(javax.mail.Message.RecipientType.TO,javax.mail.internet.InternetAddress.parse(to_tSendMail_2, false));
if(cc_tSendMail_2!=null) msg_tSendMail_2.setRecipients(javax.mail.Message.RecipientType.CC, javax.mail.internet.InternetAddress.parse(cc_tSendMail_2, false));
if(bcc_tSendMail_2!=null) msg_tSendMail_2.setRecipients(javax.mail.Message.RecipientType.BCC, javax.mail.internet.InternetAddress.parse(bcc_tSendMail_2, false));

msg_tSendMail_2.setSubject(subject_tSendMail_2);
for (int i_tSendMail_2 = 0; i_tSendMail_2 < headers_tSendMail_2.size(); i_tSendMail_2++) {
java.util.Map<String, String> header_tSendMail_2 = headers_tSendMail_2.get(i_tSendMail_2);
msg_tSendMail_2.setHeader(header_tSendMail_2.get("KEY"), header_tSendMail_2.get("VALUE"));
}

msg_tSendMail_2.setSentDate(new Date());
javax.mail.Multipart mp_tSendMail_2 = new javax.mail.internet.MimeMultipart();
javax.mail.internet.MimeBodyPart mbpText_tSendMail_2 = new javax.mail.internet.MimeBodyPart();
mbpText_tSendMail_2.setText(message_tSendMail_2);
mp_tSendMail_2.addBodyPart(mbpText_tSendMail_2);

for(int i_tSendMail_2 = 0; i_tSendMail_2 < attachments_tSendMail_2.size(); i_tSendMail_2++)
{
String filename_tSendMail_2 = attachments_tSendMail_2.get(i_tSendMail_2);
javax.mail.internet.MimeBodyPart mbpFile_tSendMail_2 = new javax.mail.internet.MimeBodyPart();


javax.activation.FileDataSource fds_tSendMail_2 = new javax.activation.FileDataSource(filename_tSendMail_2 );
mbpFile_tSendMail_2.setDataHandler(new javax.activation.DataHandler(fds_tSendMail_2));
mbpFile_tSendMail_2.setFileName(fds_tSendMail_2.getName());
mp_tSendMail_2.addBodyPart(mbpFile_tSendMail_2);
}

// -- set the content --
msg_tSendMail_2.setContent(mp_tSendMail_2);

// -- Send the message --
javax.mail.Transport.send(msg_tSendMail_2);

/**
* stop
One Star

Re: Error in tmailsend

dcopp,
I'm fairly confident that it's related to the message part of the component - you have made an error in the Java code :
(("Hello")==null || "".equals("Hello"))?"\"\""sad"Hello")
Possibly the 3rd closing bracket I've highlighted. If not, please post a screenshot.
Cheers,
c0utta
One Star

Re: Error in tmailsend

I had the same error. We must put quotation marks even if the string is empty. (Example for Bcc "").