Can anybody help on sending mail through Java Code

I am trying to send the mail using the java code and I am unable to do it. My code is
import java.io.*;
import java.net.*;
import java.util.*;
import java.text.*;
public class EmailExample {
public static void main(String[] args)
Socket smtpSocket;
DataOutputStream os;
BufferedReader is;
Date dDate = new Date();
DateFormat dFormat = DateFormat.getDateInstance(DateFormat.FULL,Locale.US);
try
smtpSocket = new Socket("www.gmail.com",80);
os = new DataOutputStream(smtpSocket.getOutputStream());
is = new BufferedReader(new InputStreamReader(smtpSocket.getInputStream()));
System.out.println("Hi How is this?");
os.writeBytes("HELLO\r\n");
// You will add the email address that the server
// you are using know you as.
os.writeBytes("MAIL From: <[email protected]>\r\n");
// Who the email is going to.
os.writeBytes("RCPT To: <[email protected]>\r\n");
//IF you want to send a CC then you will have to add this
//os.writeBytes("RCPT Cc: <[email protected]>\r\n");
// Now we are ready to add the message and the
// header of the email to be sent out.
os.writeBytes("DATA\r\n");
os.writeBytes("X-Mailer: Via Java\r\n");
os.writeBytes("DATE: " + dFormat.format(dDate) + "\r\n");
System.out.println("DATE: " + dFormat.format(dDate) + "\r\n");
os.writeBytes("From: Me <[email protected]>\r\n");
os.writeBytes("To: YOU <[email protected]>\r\n");
//Again if you want to send a CC then add this.
//os.writeBytes("Cc: CCDUDE <[email protected]>\r\n");
//Here you can now add a BCC to the message as well
//os.writeBytes("RCPT Bcc: BCCDude<[email protected]>\r\n");
String sMessage = "Your subjectline here";
os.writeBytes("Subject: Your subjectline here\r\n");
os.writeBytes(sMessage + "\r\n");
os.writeBytes("\r\n.\r\n");
os.writeBytes("QUIT\r\n");
// Now send the email off and check the server reply.
// Was an OK is reached you are complete.
String responseline;
while((responseline = is.readLine())!=null)
{   System.out.println(responseline);
if(responseline.indexOf("Ok") != -1)
break;
} catch (IOException e) {
e.printStackTrace();
It is compiling and runnung properly. Please Help me on this.
Thanks.
Satya.

You're mishandling the responses. You terminate if you don't get an "Ok" string, but that's not how success is defined - you should get a 200 code back, typically with an "OK" (not caps) message.
It doesn't help that you're ignoring all of the server output after each command, so you never find out if anything goes wrong.
You're also reinventing a wheel. The JavaMail API exists for this: http://java.sun.com/products/javamail/

Similar Messages

  • Reg : Problem in Sending Mail Through Java Code

    Hi All,
    I wrote java code to send email to gmail. But am getting the error as following .
    Error:
    C:\jdevstudio10134\jdk\bin\javaw.exe -client -classpath "C:\jdevstudio10134\jdev\mywork\Prasad\Project1\classes;C:\Program Files\Java\jre1.5.0_14\lib\j2ee.jar" tips.mails.SendMailTest
    javax.mail.SendFailedException: Sending failed;
    nested exception is:
         class javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 995
         at javax.mail.Transport.send0(Transport.java:218)
         at javax.mail.Transport.send(Transport.java:80)
         at tips.mails.SendMail.send(SendMail.java:53)
         at tips.mails.SendMailTest.main(SendMailTest.java:13)
    Process exited with exit code 0.
    Class :
    package tips.mails;
    import java.util.Properties;
    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.Message.RecipientType;
    import javax.mail.internet.AddressException;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeMessage;
    public class SendMail {
         private String from;
         private String to;
         private String subject;
         private String text;
         public SendMail(String from, String to, String subject, String text){
              this.from = from;
              this.to = to;
              this.subject = subject;
              this.text = text;
         public void send(){
              Properties props = new Properties();
              props.put("mail.smtp.host", "smtp.gmail.com");
              props.put("mail.smtp.port", "995");
              Session mailSession = Session.getDefaultInstance(props);
              Message simpleMessage = new MimeMessage(mailSession);
              InternetAddress fromAddress = null;
              InternetAddress toAddress = null;
              try {
                   fromAddress = new InternetAddress(from);
                   toAddress = new InternetAddress(to);
              } catch (AddressException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              try {
                   simpleMessage.setFrom(fromAddress);
                   simpleMessage.setRecipient(RecipientType.TO, toAddress);
                   simpleMessage.setSubject(subject);
                   simpleMessage.setText(text);
                   Transport.send(simpleMessage);               
              } catch (MessagingException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    ==============================================================================
    Main Class :
    package tips.mails;
    public class SendMailTest {
         public static void main(String[] args) {
              String from = "[email protected]";
              String to = "[email protected]";
              String subject = "Hi Rekha";
              String message = "A test message";
              SendMail sendMail = new SendMail(from, to, subject, message);
              sendMail.send();
    ========================
    Please help me on this .
    Thanks in Advance.

    Hi,
    smtp.gmail.com port is : 587/465
    pop.gmail.com port is : 995
    if u r using ssl connection then use port 465 for smtp.gmail.com. if u r using non-ssl connection means TLS type then u should use port 587 for smtp.gmail.com.
    For any further assistance u can refer to this forum - http://forums.sun.com/forum.jspa?forumID=43 assuming u r using javamail api.

  • Uncaught Exception occured while sending mail through abap code.

    Hi,
    Uncaught Exception occured while sending mail through abap code.Run time Errors "UNCAUGHT_EXCEPTION" occured after excuting the call method  CALL METHOD SEND_REQUEST->SEND( ).kindly help in resolving the issue.

    HI,
    Runtime Error:  UNCAUGHT_EXCEPTION details.
    Runtime Errors         UNCAUGHT_EXCEPTION
    Exception              CX_ADDRESS_BCS
    Short text
         An exception occurred that was not caught.
    What happened?
         The exception 'CX_ADDRESS_BCS' was raised, but it was not caught anywhere along
         the call hierarchy.
         Since exceptions represent error situations and this error was not
         adequately responded to, the running ABAP program 'SAPLZSEND_MAIL' has to be
         terminated.
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_ADDRESS_BCS', was not caught in
        procedure "SEND_MAIL" "(FORM)", nor was it propagated by a RAISING clause.
        Since the caller of the procedure could not have anticipated that the
        exception would occur, the current program is terminated.
        The reason for the exception is:
        An exception occurred
    How to correct the error
        If the error occures in a non-modified SAP program, you may be able to
        find an interim solution in an SAP Note.
        If you have access to SAP Notes, carry out a search with the following
        keywords:
        "UNCAUGHT_EXCEPTION" "CX_ADDRESS_BCS"
        "SAPLZSEND_MAIL" or "LZSEND_MAILU01"
        "ZSEND_EMAIL"
        If you cannot solve the problem yourself and want to send an error
        notification to SAP, include the following information:
        1. The description of the current problem (short dump)
           To save the description, choose "System->List->Save->Local File
        (Unconverted)".
        2. Corresponding system log
           Display the system log by calling transaction SM21.
           Restrict the time interval to 10 minutes before and five minutes
        after the short dump. Then choose "System->List->Save->Local File
        (Unconverted)".
        3. If the problem occurs in a problem of your own or a modified SAP
        program: The source code of the program
           In the editor, choose "Utilities->More
        Utilities->Upload/Download->Download".
    4. Details about the conditions under which the error occurred or which
    actions and input led to the error.
    The exception must either be prevented, caught within proedure
    "SEND_MAIL" "(FORM)", or its possible occurrence must be declared in the
    RAISING clause of the procedure.
    Please help me to resolve this issue.

  • Issue with sending mail through java stored procedure in Oracle

    Hello
    I am using Oracle 9i DB. I created a java stored procedure to send mail using the code given below. The java class works fine standalone. When its run from Java, mail is sent as desired. But when the java stored procedure is called from pl/sql "Must issue a STARTTLS command first" error is thrown. Please let me know if am missing something. Tried the same code in 11.2.0.2 DB and got the same error
    Error:
    javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. va6sm31201010igc.6
    Code for creating java stored procedure: (T1 is the table created for debugging)
    ==================================================
    create or replace and compile java source named "MailUtil1" AS
    import java.util.Enumeration;
    import java.util.Properties;
    import javax.mail.Message;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeMessage;
    public class MailUtil1 {
    public static void sendMailwithSTARTTLS(String host, //smtp.projectp.com
    String from, //sender mail id
    String fromPwd,//sender mail pwd
    String port,//587
    String to,//recepient email ids
    String cc,
    String subject,
    String messageBody) {
    try{
    Properties props = System.getProperties();
    props.put("mail.smtp.starttls.enable", "True"); // added this line
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.user", from);
    props.put("mail.smtp.password", fromPwd);
    props.put("mail.smtp.port", port);
    props.put("mail.smtp.auth", "true");
    #sql { insert into t1 (c1) values ('1'||:host)};
    Session session = Session.getDefaultInstance(props, null);
    MimeMessage message = new MimeMessage(session);
    message.setFrom(new InternetAddress(from));
    #sql { insert into t1 (c1) values ('2')};
    InternetAddress[] toAddress = new InternetAddress[1];
    // To get the array of addresses
    for( int i=0; i < toAddress.length; i++ ) { // changed from a while loop
    toAddress[i] = new InternetAddress(to);
    //System.out.println(Message.RecipientType.TO);
    for( int i=0; i < toAddress.length; i++) { // changed from a while loop
    message.addRecipient(Message.RecipientType.TO, toAddress);
    if (cc!=null) {
    InternetAddress [] ccAddress = new InternetAddress[1];
    for(int j=0;j<ccAddress.length;j++){
    ccAddress[j] = new InternetAddress(cc);
    for (int j=0;j<ccAddress.length;j++){
    message.addRecipient(Message.RecipientType.CC, ccAddress[j]);
    message.setSubject(subject);
    message.setText(messageBody);
    message.saveChanges();
    #sql { insert into t1 (c1) values ('3')};
    Enumeration en = message.getAllHeaderLines();
    String token;
    while(en.hasMoreElements()){
    token ="E:"+en.nextElement().toString();
    #sql { insert into t1 (c1) values (:token)};
    token ="ConTyp:"+message.getContentType();
    #sql { insert into t1 (c1) values (:token)};
    token = "Encod:"+message.getEncoding();
    #sql { insert into t1 (c1) values (:token)};
    token = "Con:"+message.getContent();
    #sql { insert into t1 (c1) values (:token)};
    Transport transport = session.getTransport("smtp");
    #sql { insert into t1 (c1) values ('3.1')};
    transport.connect(host, from, fromPwd);
    #sql { insert into t1 (c1) values ('3.2')};
    transport.sendMessage(message, message.getAllRecipients());
    #sql { insert into t1 (c1) values ('3.3')};
    transport.close();
    #sql { insert into t1 (c1) values ('4')};
    catch(Exception e){
    e.printStackTrace();
    String ex= e.toString();
    try{
    #sql { insert into t1 (c1) values (:ex)};
    catch(Exception e1)
    Edited by: user12050615 on Jan 16, 2012 12:18 AM

    Hello,
    Thanks for the reply. Actually I have seen that post before creating this thread. I thought that I could make use of java mail to work around this problem. I created a java class that succesfully sends mail to SSL host. I tried to call this java class from pl-sql through java stored procedure. That did not work
    So, is this not supported in Oracle ? Please note that I have tested this in both 9i and 11g , in both the versions I got the error. You can refer to the code in the above post.
    Thanks
    Srikanth
    Edited by: user12050615 on Jan 16, 2012 12:17 AM

  • Can someone help me send mail using SMTP server?

    I am having the most frustrating problem with SMTP outgoing email account.  I use GoDaddy's Webmail (smtp.secureserver.net) and I receive all my emails through Apple Mail but I cannot send any.  I haven't been able to for about two weeks now, aside from 3 or 4 fleeting windows of time when I could.  Almost all of the time I try to send my emails, an error message says my outgoing account is offline.  I've been on the phone with GoDaddy's tech support three times this week and did everything we could think of, which include these steps:
    -Force Quit Apple Mail --> Restart Computer
    -Change Default Ports to a specific one and uncheck "Use Secure Sockets Layer (SSL)"
    -Check "Use only this server"
    -Delete account completely from Apple Mail and re-load (which I had to go into Time Machine to recover messages, and lots a bunch in the process ugh!)
    Nothing works!  I depend on this email for my business, and I rely heavily on Apple Mail for this account.  All of my other email accounts that I pull through Mail work fine, but of course they are not SMTP outgoing.  Please help...I feel like I've tried everything and nothing works permanently. 

    At this point there are 2 possible causes to your problem:
    Apple Mail
    Connectivity between you and the SMTP server
    I can't help with (1) as I use Thunderbird as my mail client (the biggest advantage being I can take my mail files and move between different versions of Mac OS X). If you suspect that your problem is due to Apple Mail, then using another email client to send a test message will prove the point. If it works, then the problem lies with Apple Mail and somebody else will have to chip in. If it still fails, then there may be connectivity issue between you and the mail server.
    If you google "telnet smtp test" (without the quotes), you will find many articles showing you how to test an SMTP connection using telnet. Don't be put off by the fact that many of the articles assume you are running Windows. The only Mac bit you need to know is that telnet is a command line utility accessed via Terminal. The rest is generic.
    Telnet will allow you to interact with the mail server a line at a time and show you exactly what and where the problem is. If you get an unexpected response from the server, go back to GoDaddy and show them the output. If you don't get any response at all (i.e. "telnet smtpout.secureserver.net 25" just hangs), then take it up with your ISP as you are simply not getting through to the server.
    Good luck.

  • Can anybody help me sending some ABAP Objects

    Hi gurus,
      can anybody give me some ABAP objects ( i.e. Scenaro or FS or TS ).
    I am new in SAP. It will immensely be helpful to me to understand the real business scenarios.
    Any type of response is appriciated.
    Thanks,
    Ajoy Chatterjee.
    Email ID : [email protected]

    Hi Chatterjee,
    Go through this,
    OO ABAP
    http://www.sapgenie.com/abap/OO/
    For understanding COntrol Frameworks in OO ABAP, check this.
    http://www.sapgenie.com/abap/controls/index.htm
    ABAP_OBJECTS_ENJOY_0 Template for Solutions of ABAP Object Enjoy Course
    ABAP_OBJECTS_ENJOY_1 Model Solution 1: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_2 Model Solution 2: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_3 Model Solution 3: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_4 Model Solution 4: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_5 Model Solution 5: ABAP Objects Enjoy Course
    DEMO_ABAP_OBJECTS Complete Demonstration for ABAP Objects
    DEMO_ABAP_OBJECTS_CONTROLS GUI Controls on Screen
    DEMO_ABAP_OBJECTS_EVENTS Demonstration of Events in ABAP Objects
    DEMO_ABAP_OBJECTS_GENERAL ABAP Objects Demonstration
    DEMO_ABAP_OBJECTS_INTERFACES Demonstration of Interfaces in ABAP Objects
    DEMO_ABAP_OBJECTS_METHODS Demonstration of Methods in ABAP Objects
    DEMO_ABAP_OBJECTS_SPLIT_SCREEN Splitter Control on Screen
    You can get nice docs regarding OO ABAP from these links also...
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    Check this link
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    You can also check the transaction ABAPDOCU for sample abap OO programs..
    Go through the following Documents Links & Materials for ABAP Objects
    check the below links lot of info and examples r there
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    Check this cool weblog:
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/sap.user72/blog/2005/05/10/a-small-tip-for-the-beginners-in-oo-abap
    /people/ravikumar.allampallam/blog/2005/02/11/abap-oo-in-action
    /people/thomas.jung3/blog/2005/09/08/oo-abap-dynpro-programming
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    these links
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    1) http://www.erpgenie.com/sap/abap/OO/index.htm
    2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    Reward points if helpful.
    Thanks
    Naveen khan

  • How to send mail through java program in solaris server

    hi
    i am writing java code to send the mail using my company SMTP
    ,the program is working fine when i run and deploy in windows environment
    but at the same time when i deploy the war to sun solaris server ,it is not working
    and throwing the Error saying
    java.lang.Exception: Invalid Addresses; nested exception is:      javax.mail.SendFailedException: 553 sorry, that domain isn't allowed to be relayed thru this MTA without authentication #5.7.1     at jsp.SendMail._jspService(_SendMail.java:137)
    i am using the Authentication also using user id and password of same domain and it is able to authenticate
    in windows but not in Solaris
    where i am making mistake plz
    guide.
    Saurabh

    thanks Alan
    but i think there is some other problem because same code is
    working when i am using in windows as well as i am using authentication method
    also but it is not working when running in Solaris Environment
    here is the code i am using to send the mail
    props.setProperty("mail.transport.protocol", "smtp");
    props.setProperty("mail.host", "smtp.mycompany.com");//smtp protocol for IIBF
    props.put("mail.smtp.starttls.enable","true");//setting start TLS to be true
    props.put("mail.smtp.auth", "true");// authentication is false
    props.put("mail.smtp.port", port);//setting the port number it can be either 25 or 587
    props.put("mail.smtp.username", "noreply");
    props.put("mail.smtp.password","noreply");
    props.put("mail.debug", "true");
    Authenticator auth = new SMTPAuthenticator();
    Session session1 = Session.getDefaultInstance(props);
    java.util.Properties sessionProperties = new java.util.Properties();
    sessionProperties.put("mail.smtp.auth", "true");
    message.setFrom(new javax.mail.internet.InternetAddress(From ,"name"));
    message.addRecipient(javax.mail.Message.RecipientType.TO, new javax.mail.internet.InternetAddress(To));
    message.setText(TextCo);
    message.setSubject(subject);
    message.setContent(boyd, "text/plain");
    message.reply(true);
    Transport trans = session1.getTransport("smtp");
    trans.connect(SMTP_HOST_NAME, SMTP_AUTH_USER, SMTP_AUTH_PWD);
    boolean ddd = trans.isConnected();
    message.saveChanges();
    trans.sendMessage(message, message.getAllRecipients());
    above code is working properly in windows but not in Solaris
    plz guide what next to do
    thankx in advance
    saurabh

  • Not able to send mail through java

    Hi,
    I am sending an email through java but it gives me exception that Authentication failed exception but I have provided correct credentials
    I have given stack trace as below
    19 Mar 2013 16:32:58,579 614378 [[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'] ERROR alfaaesar.portal.pages.common.bo.AfCmnCommonBO  – AfCmnCommonBo SendMail Exception:javax.mail.AuthenticationFailedException
         at javax.mail.Service.connect(Service.java:319)
         at alfaaesar.portal.pages.common.bo.AfCmnCommonBO.sendMail(AfCmnCommonBO.java:939)
         at alfaaesar.portal.pages.literature.action.AfLitetatureRequestAndViewAction.InsertLiteratureReqDtlsInAlfaLitHeaderTbl(AfLitetatureRequestAndViewAction.java:619)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sun.el.parser.AstValue.invoke(Unknown Source)
         at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
         at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
         at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:889)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:379)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:194)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at alfaaesar.portal.pages.filter.AnonymousSessionFilter.doFilter(AnonymousSessionFilter.java:47)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.portlet.client.adapter.adf.ADFPortletFilter.doFilter(ADFPortletFilter.java:32)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.webcenter.framework.events.dispatcher.EventDispatcherFilter.doFilter(EventDispatcherFilter.java:44)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.wcps.client.PersonalizationFilter.doFilter(PersonalizationFilter.java:75)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.webcenter.content.integration.servlets.ContentServletFilter.doFilter(ContentServletFilter.java:168)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.webcenter.lifecycle.filter.LifecycleLockFilter.doFilter(LifecycleLockFilter.java:151)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:179)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)Also given code below in java to send an email .
                    public  Boolean sendMail(String host,String port,String debugFlag,String authFlag, String userId,String password,String fromEmailAddress,String toEmailAddress,String subject,String eMailcontent ) throws MessagingException {
            Boolean sendMailFlag = false;
            Properties props = new Properties();
            props.put("mail.smtp.host", host);
            props.put("mail.smtp.port", port);
            props.put("mail.debug", debugFlag); //Set default to false
            props.put("mail.smtp.auth", authFlag); //Set default to true
            props.put("mail.transport.protocol", "smtp");
            props.put("mail.smtp.sendpartial","true");
           // props.put("mail.smtp.starttls.enable", "true");
            logger.info("Sending Email.......");
            //System.out.println("Sending Email.......");
            try {
                // Instantiatee a message
                final String mailUserId = userId;
                final String mailPassword = password;
               Session mailSession = Session.getDefaultInstance(props, new Authenticator() {
                protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(mailUserId, mailPassword);
               MimeMessage msg = new MimeMessage(mailSession);
                msg.setFrom(new InternetAddress(fromEmailAddress));
               String[] to = toEmailAddress.split(",");
               InternetAddress[] addressTo = new InternetAddress[to.length];
                     for (int i = 0; i < to.length; i++)
                         addressTo[i] = new InternetAddress(to);
    msg.setRecipients(Message.RecipientType.TO, addressTo);
    if(JSFUtils.getFromSession("ccEmailAddress")!=null){
    String ccEmailAddress =(String)JSFUtils.getFromSession("ccEmailAddress");
    JSFUtils.removeFromSession("ccEmailAddress");
    String[] cc = ccEmailAddress.split(",");
    InternetAddress[] addressCC = new InternetAddress[cc.length];
    for (int i = 0; i < cc.length; i++)
    addressCC[i] = new InternetAddress(cc[i]);
    msg.setRecipients(Message.RecipientType.CC, addressCC);
    msg.setSubject(subject,"utf-8");
    msg.setSentDate(new Date());
    //msg.setText(eMailcontent);
    msg.setContent(eMailcontent, "text/html; charset=\"utf-8\"");
    if (toEmailAddress.indexOf(',') > 0)
    msg.setRecipients(Message.RecipientType.TO,
    InternetAddress.parse(toEmailAddress));
    else
    msg.setRecipient(Message.RecipientType.TO,
    new InternetAddress(toEmailAddress));
    Transport transport = mailSession.getTransport();
    transport.connect(host,Integer.parseInt(port),userId.trim(),password.trim());
    transport.send(msg);
    transport.close();
    //Send the message
    // Transport.send(msg);
    sendMailFlag = true;
    // System.out.println("mail sent");
    } catch (MessagingException mex) {
    // Prints all nested (chained) exceptions as well
    //logger.info(mex.getMessage());
    logger.error("AfCmnCommonBo SendMail Exception:"+JSFUtils.getStackTrace(mex));
    //mex.printStackTrace();
    sendMailFlag = false;
    return sendMailFlag;
    Edited by: Wecenter Guru on Mar 19, 2013 5:02 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Hi All,
    My question got resolved.It is due to the userId and fromEmailAddress was not of same account holder.because of which it is giving relaying denied type exception

  • Want hepl in sending mail vai java code

    Hi
    I want to write code for sending email from java apllication.
    I done that, it works fine onle i send mail within my smtp server i.e. with in my comapny id's but it throws following excpetion when i give from id other than my comapny id
    Exception in thread "main" javax.mail.SendFailedException: Sending failed;
    nested exception is:
    javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
    javax.mail.SendFailedException: 550 5.7.1 Unable to relay for meetraj14@
    yahoo.co.in
    at javax.mail.Transport.send0(Transport.java:219)
    at javax.mail.Transport.send(Transport.java:81)
    at mailchk.main(mailchk.java:27)
    Pleas help me
    My code is
    import java.util.*;
    import java.io.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    class mailchk
         public static void main(String[] args) throws Exception
              String to="[email protected]";
              String from="[email protected]";
              String subject="cheking";
              String message="this is a testing mail from java program";
              System.out.println("Hello World!");
              Properties props = new Properties();
              props.put("mail.smtp.host", "xchange.sigma.com");
              Authenticator auth = (new mailchk()).new SMTPAuthenticator();
              Session session = Session.getDefaultInstance(props,auth);
              MimeMessage msg = new MimeMessage(session);
              msg.setFrom(new InternetAddress(from));
              msg.setRecipient(MimeMessage.RecipientType.TO, new InternetAddress(to));
              msg.setSubject(subject);
              msg.setSentDate(new Date());
              msg.setContent(message, "text/plain");
              Transport.send(msg);
         private class SMTPAuthenticator extends javax.mail.Authenticator
    public PasswordAuthentication getPasswordAuthentication()
    String username = "prithvirajm";
    String password = "welcome";
    return new PasswordAuthentication(username, password);
    }

    i made changes accordingly
    i wrote 1 standalone program which work successfully i.e. it can send more than 1 mail
    but in my actual application ,it can send only 1 mail successfully, 2nd time it shows follwing exception
    exception occues due to javax.mail.SendFailedException: Sending failed;
    nested exception is:
    javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
    nested exception is:
    java.net.ConnectException: Connection refused
    I am attaching part of application code
    please helpme
    if(extFuncName.equals("sendEmail"))
         log.info("insdie sending mail");
         try
         try
         CallArg textMsgArgMail = args.getArg("to");
         this.to = textMsgArgMail.getValue();
         log.info("value of to"+this.to);                    textMsgArgMail = args.getArg("from");               this.from = textMsgArgMail.getValue();               log.info("value of from "+this.from);                    textMsgArgMail = args.getArg("subject");               this.subject = textMsgArgMail.getValue();               log.info("value of subject "+this.subject);               textMsgArgMail = args.getArg("email_data");               this.message = textMsgArgMail.getValue();               log.info(" email to be send to"+to+" from "+from+" with subject "+subject);                         log.info("email data "+message);                    }
         catch(CallArgException e){
                                       throw new TaskConfigError("missing input arg FileData in external function "+
    extFuncName, t.createTask(), e);
         }                         Properties props = new Properties();               props.put("mail.transport.protocol", "smtp");               props.put("mail.smtp.starttls.enable","true");               log.info("value of smtp host is "+this.smtpHost);          props.put("mail.smtp.host", this.smtpHost);               //props.put("mail.smtp.host", "193.168.1.4");               Session session = Session.getDefaultInstance(props);          
                             MimeMessage msg = new MimeMessage(session);
                             msg.setFrom(new InternetAddress(from));
                             msg.setRecipient(MimeMessage.RecipientType.TO, new InternetAddress(this.to));
                             msg.setSubject(this.subject);
                             msg.setSentDate(new Date());
                             msg.setContent(this.message, "text/plain");
                             Transport.send(msg);                    this.to="";                         this.from="";
                             this.subject="";
                             this.message="";                         log.info("email is sent suuceefully");
    catch (Exception mailexp)
    log.info("exception occues due to "+mailexp.toString());
                        //throw new
              }

  • Error while sending Email through Java Code in OIM

    Hi All,
    I have created a java code using tcEmailNotificationUtil, and integrated the same with the adapter.
    I am triggering this adapter when an approval process gets completed.
    As soon as the approval process gets completed my email task is triggering but the task is getting rejected.
    I have checked my system configuration for mail server settings.Everything seems working fine.
    Can you please help me in this issue how to debug?
    Thanks in advance.

    Hi,
    Here is my log file:
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/insertTaskHistory left.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/run entered.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/execute entered.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/initialize entered.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/getAttribute entered.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/getAttribute left.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/getUtility entered.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/getUtility left.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.ACCOUNTMANAGEMENT] - Class/Method: tcUtilityFactory/getRemoteUtility - Data: moUtil - Value: Thor.API.Operations.tcAuditOperationsClient
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/initialize left.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/processAllByIdentifier entered.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped entered.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped left.
    DEBUG,25 Apr 2011 10:40:00,100,[XELLERATE.DATABASE] - select A.* from (select aud_jms_key, aud_class, identifier from aud_jms order by aud_jms_key) A where rownum <= ?
    INFO,25 Apr 2011 10:40:00,101,[XELLERATE.PERFORMANCE] - Query: DB: 1, LOAD: 0, TOTAL: 1
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped entered.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped left.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped entered.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped left.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/execute left.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/run left.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isSuccess entered.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isSuccess left.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SERVER] - Class/Method: SchedulerTaskLocater /removeLocalTask entered.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SERVER] - Class/Method: SchedulerTaskLocater /removeLocalTask left.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/updateStatusToInactive entered.
    DEBUG,25 Apr 2011 10:40:00,104,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/updateStatusToInactive left.
    DEBUG,25 Apr 2011 10:40:00,104,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/updateTaskHistory entered.
    DEBUG,25 Apr 2011 10:40:00,106,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/updateTaskHistory left.
    DEBUG,25 Apr 2011 10:40:00,106,[XELLERATE.SERVER] - Clearing Security Associations with thread executing Scheduled task
    DEBUG,25 Apr 2011 10:40:00,106,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/run left.
    DEBUG,25 Apr 2011 10:40:00,106,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/execute left.
    and I just wanted to ensure that my coding part is also fine.
    Posting the code even:
    tcDataProvider ioDatabase = new tcDataBaseClient();
    tcEmailNotificationUtil sendMail = new tcEmailNotificationUtil(ioDatabase);
    sendMail.setBody("Sample Message");
    sendMail.setSubject("subject");
    sendMail.setFromAddress("fromemailaddress");
    sendMail.sendEmail("recepient");
    Thanks in Advance.

  • Can anybody help with some subtleties to this code?

    Hello,
    I was wondering if anyone could take a look at the code in general for me, which is to go in an 'effects' pedal.  The first while loop is for a footswitch that either reads high or low.  It controls the mode of the pedal.  the first mode is the default, where no signal manipulation occurs, and what comes in the audio input just comes out; the second mode stores data (fundamental frequency, average FFT amplitude from 3 kHz to 5 kHz) from the E string of a guitar, which is plucked after that mode is actuated; the third mode does the same for the A string; and the final mode takes in a note on the E or string, recognizes it as either on the E or A string, and adjusts the frequency content to be in tune based the data stored in modes 2 and 3.  then the new magnitude vector is put through an inverse FFT and output through the DAC and sounded.
    What I'm curious to know is, are there any blatant errors I've made?  Will the signal coming out of the inverse FFT be sounded through the DAC? does it need to be changed from a double to an I32?  I am trying to debug, but right now I'm having problems getting the correct output voltages on the Blackfin (the SPORT 0 pinout doesn't seem to match what is on the board....).
    also, I was wondering if I will lose any phase information on the signal that I get out compared to the signal I put in.  Will it be detectable by ear?  Or would it all sound the same?  along with the phase change for some signals, using an inverse FFT resulted in a loss of amplitude (from about 1 to on the order of 10^-5.  that's a lot!).  but when the test program was played on my computer, the phase change was not noticeable from the output signal, and neither was the magnitude change!  the output played at the same volume as in the input, despite the waveform chart on the front panel showing an amplitude five orders of magnitude less!  can you help explain that to me?  what can I do, will it matter coming out of the Blackfin and into an amplifier?
    i appreciate any input anyone can give me on all this!!  thank you!!
    Attachments:
    102 project.vi ‏287 KB

    Hi noahgrant,
    I've had a look at your vi and can make some suggestions that you can try.
    From what I can see, your while loop with the wait timer of 100 ms and continue if true condition on it (we shall cool this loop 1) will always keep running.
    The other while loop (loop 2) is nested within a couple of case structures and will only run once (false to a continue if true condition). The default case has a different condition and will always run, instead.
    From what I can make of this, loop 2 and all its case structures will only run once (except for case 0, default). WHEN it runs will depend on how it was compiled on the Blackfin - case structure/loop2 may go first or loop 1 will go first.
    If you want loop 2 to go first (and only go once) then you need to link the output of the case structure to the input of loop 1 - this can be done by simply wiring up a boolean to it (data flow rules).
    If you want loop 2 to always be checking the status of the mode then you need to place the whole case structure within a while loop, to run continuously.
    That is a very quick interpretation of what you are trying to do. There are a lot of question marks (missing vi's) and some heavy use of local variables. I would consider using sub-vi's, in particular functional global variables (FGV's).
    I hope that helps.

  • Send mail through Java program. ERROR javax.mail.MessagingException: [EOF]

    Hi,
    i've a java Mail program which will send the mail thro smtp server.
    when i try to execute this program im getting the error javax.mail.MessagingException: [EOF]
    i've attached both code & error.
    while running the program need to give the arguments
    ex : java SendMail smtpserver frommailid tomailid subject body
    please provide me the solution.
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    public class SendMail {
         public static void main(String[] args) {
              try
         String smtpServer=args[0];
         String to=args[1];
         String from=args[2];
         String subject=args[3];
         String body=args[4];
         send(smtpServer, to, from, subject, body);
         catch (Exception ex)
         System.out.println("Usage: java SendMail"
         +" smtpServer toAddress fromAddress subjectText bodyText");
         System.exit(0);
         public static void send(String smtpServer, String to, String from
                   , String subject, String body)
                   try
                   Properties props = System.getProperties();
                   props.put("mail.smtp.host", smtpServer);
                   Session session = Session.getDefaultInstance(props, null);
                   Message msg = new MimeMessage(session);
                   msg.setFrom(new InternetAddress(from));
                   msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(to, false));
                   msg.setSubject(subject);
                   msg.setText(body);
                   msg.setSentDate(new Date());
                   System.out.println("test 1--");
                   Transport.send(msg);
                   System.out.println("test 2--");
                   System.out.println("Message sent OK.");
                   catch (Exception ex)
                   ex.printStackTrace();
    thanks for the help in advance.
    regs
    lal.

    I ran into a similar error today. I fixed it by setting up SMTP authentication because my ISP's help pages said that they would allow only SMTP authentication.
    Here is what I did:
    Transport transport =
    mailConnection.getTransport("smtp");
    transport.connect(
    "hostname", "email", "password");
    Transport.send(msg);
    I also passed the following property while creating the session:
    props.put("mail.smtp.auth", "true");
    finally turning on debug helped:
    session.setDebug(true);
    session.setDebugOut(null);
    Hope this helps

  • How Server can read client side SSL certificates through java code?

    My code will be running on server which will be a java class that should read any SSL certificates for the user that is logging in to the application.
    Kindly let me know how it can be achieved ? I have very rare knowldge on Security. how i can read SSL certificates of the client machine.
    Also let me know the possible solutions for above question.

    For my mud written in java, I used TCP/IP for the connections. When a client connects, he gets his own thread. Those threads are held in a vector in a manager class. each tick of the server does a quick run thru the vector and if the current thread/socket its on is null or !isAlive() its remove from the vector(which in turn removes it from getting any more game updates. This removal can be caused by two things. The clients disconnects by accident(kills his game, locks up has an internet connection hiccup, etc.) or he uses the games "quit" method. The quit method calls a method that does any player saving of data, etc then closes the socket, and sets it to null. thus the manager sees this and removes him frm the vecotr list on the next server tick. Seems to work great form a mud and worked really well in a multiplayer applet game I had up for a while.

  • Can anybody help me and find why that code cause that exception

    Hi
    I'm standing whole the day finding out why that code cause the following exception but i couldn't so any help
    The exception:
    Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
    package simulation;
    import javax.swing.*;
    import java.io.*;
    import java.lang.*;
    import java.math.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.util.*;
    * @author Enegm
    public class Main {
       void InitGui()
           f=new JFrame("Simulation");
           f.setBounds(200,200,300,200);
           f.setLayout(null);
           l1=new JLabel("<html>\u03b2<sub>a</sub></html>");
           l2=new JLabel("<html>\u03b2<sub>s</sub></html>");
           l3=new JLabel("The number of delaies desired");
           t2=new JTextField();
           t1=new JTextField();
           t3=new JTextField();
           b1=new JButton("Simulate");
            Draw d;
            b1.addActionListener(new
                ActionListener()
                    public void actionPerformed(ActionEvent event)
                        //Main m=new Main();
                        new Thread()
                            public void run()
                    Draw();
                   //  Draw1();
                            }}.start();
    //                     f1=new JFrame("Q(t) vs t");
    //                    float MX=MaxX(QT);
    //                    float MY=MaxY(QT);
    //                   d=new Draw(MX,MY,QT,BT);
    //                    d.setBounds(10,10,580,280);
    //                    d.setBackground(Color.WHITE);
    //                    f1.setLayout(null);
    //                    f1.setBounds(50,0,610,340);
    //                    f1.getContentPane().add(d);
    //                    f1.setVisible(true);
           l1.setBounds(50,50,30,50);
           t1.setBounds(90,60,30,20);
           l2.setBounds(150,50,30,50);
           t2.setBounds(190,60,30,20);
           b1.setBounds(100,130,100,30);
           l3.setBounds(30,100,175,20);
           t3.setBounds(210,100,30,20);
           f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           f.getContentPane().add(l1);
           f.getContentPane().add(t1);
           f.getContentPane().add(l2);
           f.getContentPane().add(t2);
           f.getContentPane().add(l3);
           f.getContentPane().add(t3);
           f.getContentPane().add(b1);
           f.setVisible(true);
        public Main() {
         * @param args the command line arguments
        public static void main(String[] args) {
            Main m=new Main();
            m.InitGui();
              r=new Random();
    //          while(true)
    //              if(flag==1)
    //                 m.Draw();
    //        int NEv;
    //        r=new Random();
    //        m.Initialize();
    //        while(ND<=Integer.parseInt(t3.getText()));
    //            NEv=m.TimingRoutine();
    //            if(NEv==0)
    //                m.Arrival();
    //            else
    //                m.Departure();
       public void Initialize()
            SS=false;
            NIQ=0;
            TOLE=0;
            ND=0;
            TD=0;
             float temp1=Float.parseFloat(t1.getText());
            EList[0]=-temp1*((float)(Math.log(r.nextFloat())));
            EList[1]=(float)10e6;
            CLK=0;
            QT=new Vector<Point2D>(100);
            BT=new Vector<Point2D>(100);
       public  void Draw()
           System.out.println(""+java.lang.Runtime.getRuntime());
           int NEv;
                     ND=0;
                      Initialize();
            while(ND<Integer.parseInt(t3.getText()))
                NEv=TimingRoutine();
                if(NEv==0)
                   Arrival();
               else
                    Departure();
                     // System.out.println("ADSDDA SAD");
                       f1=new JFrame("Q(t) vs t");
                        float MX=MaxX(QT);
                        float MY=MaxY(QT);
                        d=new Draw(MX,MY,QT,BT,1);
                        d.repaint();
                        d.setBounds(10,10,600,280);
                        d.setBackground(Color.WHITE);
                        f1.setLayout(null);
                        f1.setBounds(50,0,630,340);
                        f1.getContentPane().add(d);
                        f1.setVisible(true);
                           System.out.println(""+java.lang.Runtime.getRuntime());
        public  void Draw1()
           System.out.println(""+java.lang.Runtime.getRuntime());
           int NEv;
                     ND=0;
                      Initialize();
            while(ND<Integer.parseInt(t3.getText()))
                NEv=TimingRoutine();
                if(NEv==0)
                   Arrival();
               else
                    Departure();
                     // System.out.println("ADSDDA SAD");
                       f1=new JFrame("B(t) vs t");
                        float MX=MaxX(QT);
                        float MY=MaxY(QT);
                        d=new Draw(MX,MY,QT,BT,0);
                        d.repaint();
                        d.setBounds(10,10,600,280);
                        d.setBackground(Color.WHITE);
                        f1.setLayout(null);
                        f1.setBounds(50,350,630,340);
                        f1.getContentPane().add(d);
                        f1.setVisible(true);
                           System.out.println(""+java.lang.Runtime.getRuntime());
       public void Arrival()
           float AT=EList[0];
           float temp1,temp2;
           temp1=Float.parseFloat(t1.getText());
           temp2=Float.parseFloat(t2.getText());
         Point2D state,state1;
           EList[0]=(-temp1*((float)Math.log((r.nextFloat()))))+AT;
          if(SS==true)
              NIQ+=1;
              state=new Point2D.Float(CLK,1);
            //  state.setLocation(CLK,1);
          else
              TD=0;
              ND+=1;
              SS=true;
              EList[1]=(-temp2*((float)Math.log(r.nextFloat())))+CLK;
              state=new Point2D.Float(CLK,1);
              //state.setLocation(CLK,1);
          state1=new Point2D.Float(CLK,NIQ);
        //  state1.setLocation(CLK,NIQ);
            QT.add(state1);
          BT.add(state);
       public void Departure()
           Point2D state,state1;
           float temp=Float.parseFloat(t2.getText());
           if(NIQ==0)
               SS=false;
               state=new Point2D.Float(CLK,0);
              // state.setLocation(CLK,0);
           else
               NIQ--;
               ND++;
               //temp=TOA.remove(0);
               SS=true;
                EList[1]=(-temp*((float)Math.log((r.nextFloat()))))+CLK;
                state=new Point2D.Float(CLK,0);
                // state.setLocation(CLK,0);
              state1=new Point2D.Float(CLK,NIQ);
               //state1.setLocation(CLK,NIQ);
            QT.add(state1);
            BT.add(state);
       public int TimingRoutine()
           int NE;
           if(EList[0]<EList[1])
           {   CLK=EList[0];
               return 0;}
           else
           {   CLK=EList[1];
               return 1;}
       public float MaxX(Vector<Point2D> pts)
           int len =pts.size();
           float Max=0;
           float temp=0;
           for(int i=0;i<len;i++)
               temp=(float)pts.get(i).getX();
               if(Max<temp)
               Max=temp;
           return Max;
        public float MaxY(Vector<Point2D> pts)
           int len =pts.size();
           float Max=0;
           float temp=0;
           for(int i=0;i<len;i++)
               temp=(float)pts.get(i).getY();
               if(Max<temp)
               Max=temp;
           return Max;
      public static Random r;
      public static JFrame f; 
      public static JFrame f1; 
      public static JLabel l1;
      public static JTextField t1;
      public static JLabel l2;
      public static JTextField t2;
      public static JButton b1;
      public static JLabel l3;
      public static JTextField t3;
      public static boolean SS;
      public static int NIQ;
      public static float TOLE;
      public static int ND;
      public static float TD;
      public static Draw d;
      public static Vector<Point2D>QT;
      public static Vector<Point2D>BT;
      public static Vector<Float>TOA;
      public float[] EList=new float[2];
      public static float CLK;
      public static int flag=0;
    class Draw extends JPanel
        public Draw(float x,float y,Vector<Point2D> QT,Vector<Point2D> BT,int dif)
           MX=x;
           MY=y;
           this.QT=QT;
           this.BT=BT;
           this.dif=dif;
        public void paintComponent(Graphics g)
            super.paintComponent(g);
       Graphics2D g2=(Graphics2D) g;
        Line2D L;
        if(dif==1)
        Draw(g2);
        else
              Draw1(g2);
          return;
        public void Draw(Graphics2D g2)
            Line2D L;
            java.text.DecimalFormat dfm = new java.text.DecimalFormat("00.##");
        float tempx,tempy,x,y;
      g2.setColor(Color.BLACK);
      g2.drawLine(0,260,600,260);
      g2.drawLine(10,0,10,280);
      g2.drawLine(578,255,600,260);
      g2.drawLine(578,265,600,260);
       x=(float)((QT.get(0).getX()*580)/MX);
      y=(float)((QT.get(0).getY()*260)/MY);
      int stepx=(int)(580/10+10);int stepy=(int)(260/10);
      String stepx1=""+(int)(MX/10);String stepy1=""+(int)(MY/10);
      String tempc="";
      if((int)(MX/10)==0)
          stepx1=dfm.format(MX/10);;
      if((int)(MY/10)==0)
          stepy1=dfm.format(MY/10);
      int temp=10;double temp1=0;
      for(int i=0;i<10;i++)
          if(temp1>MX)
              break;
          g2.drawString(""+temp1,(int)temp,270);
          temp=temp+stepx;
          temp1=temp1+Double.parseDouble(stepx1);
          tempc=dfm.format(temp1);
          temp1=Double.parseDouble(tempc);
      temp=0;temp1=0;
      for(int i=0;i<10;i++)
          g2.drawString(""+temp1,0,260-temp);
          temp=temp+stepy;
          temp1=temp1+Double.parseDouble(stepy1);
           tempc=dfm.format(temp1);
          temp1=Double.parseDouble(tempc);
       g2.setColor(Color.blue);
      for(int i=1;i<QT.size();i++)
         tempx=(float)((QT.get(i).getX()*580)/MX+10);
         tempy=(float)((QT.get(i).getY()*260)/MY);
         L=new Line2D.Float(x,260-y,tempx,260-y);
          g2.draw(L);
         L=new Line2D.Float(tempx,260-y,tempx,260-tempy);
         g2.draw(L);
    //     g2.drawLine(10,10,260,10);
    //     g2.drawString(""+QT.get(i).getX(),tempx,260);
         x=tempx;y=tempy;  
         public void Draw1(Graphics2D g2)
            Line2D L;
            java.text.DecimalFormat dfm = new java.text.DecimalFormat("00.##");
        float tempx,tempy,x,y;
      g2.setColor(Color.BLACK);
      g2.drawLine(0,260,600,260);
      g2.drawLine(10,0,10,280);
      g2.drawLine(578,255,600,260);
      g2.drawLine(578,265,600,260);
       x=(float)((BT.get(0).getX()*580)/MX);
      y=(float)((BT.get(0).getY()*260)/MY);
      int stepx=(int)(580/10+10);int stepy=(int)(260/10);
      String stepx1=""+(int)(MX/10);String stepy1=""+(int)(MY/10);
      String tempc="";
      if((int)(MX/10)==0)
          stepx1=dfm.format(MX/10);;
      if((int)(MY/10)==0)
          stepy1=dfm.format(MY/10);
      int temp=10;double temp1=0;
      for(int i=0;i<10;i++)
          if(temp1>MX)
              break;
          g2.drawString(""+temp1,(int)temp,270);
          temp=temp+stepx;
          temp1=temp1+Double.parseDouble(stepx1);
          tempc=dfm.format(temp1);
          temp1=Double.parseDouble(tempc);
      temp=0;temp1=0;
      for(int i=0;i<10;i++)
    //      if(temp1>MY)
    //          break;
    //      if((temp1-(int)temp1)!=0)
    //          continue;
          g2.drawString(""+temp1,0,260-temp);
          temp=temp+stepy;
          temp1=temp1+Double.parseDouble(stepy1);
           tempc=dfm.format(temp1);
          temp1=Double.parseDouble(tempc);
       g2.setColor(Color.blue);
      for(int i=1;i<QT.size();i++)
         tempx=(float)((BT.get(i).getX()*580)/MX+10);
         tempy=(float)((BT.get(i).getY()*260)/MY);
         L=new Line2D.Float(x,260-y,tempx,260-y);
          g2.draw(L);
         L=new Line2D.Float(tempx,260-y,tempx,260-tempy);
         g2.draw(L);
    //     g2.drawLine(10,10,260,10);
    //     g2.drawString(""+QT.get(i).getX(),tempx,260);
         x=tempx;y=tempy;  
         public float MaxX(Vector<Point2D> pts)
           int len =pts.size();
           float Max=0;
           float temp=0;
           for(int i=0;i<len;i++)
               temp=(float)pts.get(i).getX();
               if(Max<temp)
               Max=temp;
           return Max;
        public float MaxY(Vector<Point2D> pts)
           int len =pts.size();
           float Max=0;
           float temp=0;
           for(int i=0;i<len;i++)
               temp=(float)pts.get(i).getY();
               if(Max<temp)
               Max=temp;
           return Max;
    public static JFrame f1;
    public static JFrame f2;
    public static float MX;
    public static float MY;
    public static Vector<Point2D> QT;
    public static Vector<Point2D> BT;
    public static int dif;

    Hard to tell. Somewhere you're creating objects without ever releasing them. Are you endlessly adding to a list or something?
    System.out.println(""+java.lang.Runtime.getRuntime());What are those calls good for?
    And may I suggest you to stick to the Java coding conventions (lower-case method and variable names) and generally find better names for your classes and methods?

  • How can i send and recieve mail through java

    HI All,
    plz let me know how can i send and receive mail through java.
    Regards:
    sachin kakkar
    http://www.datamansoftwares.com

    Using java mail API..
    try to search the forum for java mail... you find many question and answer.
    use the left search textfield

Maybe you are looking for

  • I need to reformat my computer, but i do not have an external hard drive, is there another way to do this

    i need to reformat my laptop, but dont want to mess up my itunes and purchases my i tunes has downloaded music and apps and a few book and movies on it, all downloaded through itunes on this computer or on my ipad/iphone what is the best way to make

  • How to include a custom Tx code  in easy access?

    Hello friends,                    I have created 3 custom Txcodes and i have been able to include them in SAP easy access page. But i want to include separate folder as EMPID under logistics and then include my three Txcodes can anyone help me with t

  • How can I get rid of the extra data page on a pdf?

    Whatever happened to the old pdf creater?  It was so easy to use!  Now I get this extra page of data and the other pages are reversed.  How can I get back to what works?

  • SCOM Alerts Connector run as failed

    Hi I have setup the SCOM alerts connector in SCSM but after that i starts to get wernings in scom on servers there are in a difrent domain.  werning:  Description: The Health Service cannot verify the future validity of the RunAs account Domain1\SCOM

  • Setrepo to a resource that is assigned from a cluster

    A clew would be nice. The command ./lh setrepo -v -tDatastore -icom.sun.enterprise.naming.SerialInitContextFactory -fjdbc/_IdMPool -uiiop://localhost:33700 fails owing to being unable to find jdbc/_IdMPool This is configured on the cluster, not on th