Sending mail in java using sendmail programme of lynix

Hi,
How can I send mail using Java and lynux "sendmail" programme located at i.e sendmail: /usr/sbin/sendmail.
I don't want to use JavaMail API for sending. I want to use sendmail of lynix server. Plz help me. It's very uregent.
Regards,
Devom

Hey Guys, here is the workaround for sending mails in java through javamail program of linux/unix:
step 1 - Create a shell script which sends the mail using the 'sendmail' program. I have written below code in my shell script:
#!/bin/sh
#script to send simple email
# email subject
SUBJECT="Test Subject"
# Email To ?
EMAIL="[email protected],[email protected]"
# Email text/message. This file will be automatically created and all text will be appended in it.
EMAILMESSAGE="/tmp/emailmessage.txt"
echo "This is a sample mai text."> $EMAILMESSAGE
echo "And this is a also." >>$EMAILMESSAGE
echo " " >>$EMAILMESSAGE
echo " " >>$EMAILMESSAGE
echo "Thanks & Regards," >>$EMAILMESSAGE
echo "--Your Name" >>$EMAILMESSAGE
mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
So create this script and save it as 'sendmail.sh' name in the same directory where you are executing your main java class. Please also note that this file should have full executable permissions for the program which is using this file.
Step 2- Here is my Java code that executed this shell script:
public void sendEmail()
String operatingSystemProp = "os.name";
String operatingSystemName = System.getProperty(operatingSystemProp);
if(!operatingSystemName.startsWith("Windows"))
String cmd = "./sendmail.sh";//unix shell script
try
     Runtime.getRuntime().exec(cmd);
}catch (Exception e)
     e.printStackTrace();
You just need to call this method in your java code. This method will actually pick that shell script in runtime and will execute it, the rest will be handled by the shell script itself.
So this workaround works fine for me and now I am sending mails through my java program using sendmail.
Cheers!

Similar Messages

  • Sending mails with attachments using oracle 8i

    Hi,
    Could anybody please send a sample code for sending mails
    with attachments using oracle 8i.
    Thanks in advance

    For oracle8i there is an example package from OTN:
    http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
    You have to re-write the package a bit to work it with BLOBs instead of RAW attachments, but that should be no problem
    Hop this helps,
    Michiel

  • 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.

  • Sender  Mail Adapter - java.lang.NullPointerException in CC monitoring

    hi,
    I configured my Sender Mail Adapter correctly.
    I have the correct POP URL, authentication. I'm not using PayloadSwapBean right now.
    I can't get rid of the exception inside my Channel monitoring.
    exception caught during processing mail message; java.lang.NullPointerException
    does anyone know why?
    I've been told the POP account has emails already.
    I will try to create an outlook account for this POP e-mail account in the mean time to see the e-mails.
    Thank you

    thanks aaron.
    I don't see the folder ./SYS/../j2ee/...
    will it be under another folder?  I don't see a trace log folder either.
    I think the problem might be in the Module tab.
    I tried.
    AF_Modules/PayloadSwapBean
    localejbs/AF_Modules/PayloadSwapBean
    /localejbs/AF_Modules/PayloadSwapBean
    sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean
    localejbs/sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean
    /localejbs/sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean
    they all produce the same error. I wonder if these Beans actually exist.
    I think we might have to reinstall this Mail Adapter altogether.
    Or maybe it's really the connection to the Mail Server. But would it display this kind of message.
    This is what I'm looking at.
    Also, i had to use this URL
    pop://server:995/
    (995 is using SSL and it is the default port).  When I use this, I see the Java Null Pointer Exception a lot less frequently. Weird.

  • 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/

  • 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

  • Sender mail adapter java.lang.NullPointerException

    Hi Experts,
    I have a Mail --> PI --> R/3 scenario and I am configuring the Mail sender adapter for POP3. The issue is that the POP server is not configured to be accessed via a URL and hence the URL pop://hostname/ is causing the following error at runtime:
    1. When I use pop://FQDN host name/
    Error: exception caught during processing mail message; java.net.UnknownHostException
    2. When I use pop://IP address of host:port/
    Error: exception caught during processing mail message; java.lang.NullPointerException
    I am able to ping the POP3 server from the PI server using both the FQDN and IP address.
    Can someone please help.
    Thanks,
    Shobhit

    Hi,
    I think this problem is due to POP3 configuration at PI  basis level.  Check with basis team whether they have configured POP3 configuration at PI basis level or not.

  • Sending mail to yahoo using javamail

    hello,
    i have a javamail code which able to send mail within my domain (mailserver ) .
    but when i try to send mail to any yahoo id then i get following error :--
    javax.mail.SendFailedException: Invalid Addresses;
    please, anyone help me ; what should i do modification in my existing code for sending mail to yahoomail account.
    the code which is working properly for my doamin is:--
    import java.util.*;
    import java.io.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    public class SendMailUsage {
    public static void main(String[] args) {
    // SUBSTITUTE YOUR EMAIL ADDRESSES HERE!!!
    String to = "[email protected]";
    String from = "[email protected]";
    // SUBSTITUTE YOUR ISP'S MAIL SERVER HERE!!!
    String host = "172.13.2.48";
    // Create properties for the Session
    Properties props = new Properties();
    // If using static Transport.send(),
    // need to specify the mail server here
    props.put("mail.smtp.host", host);
    // To see what is going on behind the scene
    props.put("mail.debug", "false");
    // Get a session
    Session session = Session.getInstance(props);
    try {
    // Get a Transport object to send e-mail
    Transport bus = session.getTransport("smtp");
    bus.connect();
    Message msg = new MimeMessage(session);
    msg.setFrom(new InternetAddress(from));
    InternetAddress[] address = {new InternetAddress(to)};
    msg.setRecipients(Message.RecipientType.TO, address);
    msg.setSubject("Test E-Mail through mojax developers");
    msg.setSentDate(new Date());
    // Set message content and send
    setTextContent(msg);
    msg.saveChanges();
    bus.sendMessage(msg, address);
    bus.close();
    catch (MessagingException mex) {
    // Prints all nested (chained) exceptions as well
    mex.printStackTrace();
    // How to access nested exceptions
    while (mex.getNextException() != null) {
    // Get next exception in chain
    Exception ex = mex.getNextException();
    ex.printStackTrace();
    if (!(ex instanceof MessagingException)) break;
    else mex = (MessagingException)ex;
    // A simple, single-part text/plain e-mail.
    public static void setTextContent(Message msg) throws MessagingException {
    // Set message content
    String mytxt = "this mail is generated by java";
    msg.setText(mytxt);
    // Alternate form
    msg.setContent(mytxt, "text/plain");
    } //End of class

    Turn on session debugging to get the protocol trace. Your mail server
    is probably saying more about why the send failed than what you've
    included here.
    Then read the FAQ for likely problems.

  • Need to send mail & upload files using JSP

    hi, got a lot of issues,.. just starting out as a developer.. so here goes.
    1st Need to send mail & upload files to server using JSP(tomcat).. an example to demo it would be nice.
    thanx in advance

    Look at this for email:
    http://forum.java.sun.com/thread.jspa?forumID=45&threadID=285950
    and go to:
    http://servlets.com/cos/
    for a package to upload files.

  • 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

  • Problem with sending mail throgh java mail api

    hi folks,
    We are having problem regarding sending mail using java mail api.
    we are using msgsendsample.java file from demo folder contained in javamail-1.3.3_01 folder.
    we are using following command at dos prompt.:
    java msgsendsample [email protected] [email protected] smtp.mail.yahoo.com false
    It gives following Exception:
    --Exception handling in msgsendsample.java
    com.sun.mail.smtp.SMTPSendFailedException: 530 authentication required - for hel
    p go to http://help.yahoo.com/help/us/mail/pop/pop-11.html
    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1
    333) at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:906)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:535)
    at javax.mail.Transport.send0(Transport.java:151)
    at javax.mail.Transport.send(Transport.java:80)
    at msgsendsample.main(msgsendsample.java:93)
    ** ValidUnsent Addresses
    [email protected]
    Thanking in Advance...
    Please give us guidance to any alternate solution if exists.

    hi
    the smtp server u are using should allow u to send mail to other smtp server like if u r sending mail to yahoo account u have to use yahoo smtp server only .....
    bye

  • Sending mail in java

    Hi,
    I am working on remailer application.
    I want to send mail to multiple recipiants .
    But I want to hide my IP from recipiants. I want to use annoymous proxy server for sending mail .
    Can anybody tell me how can I do it using java .
    any kind of help will be appciated

    I want to send mail to multiple recipiants .
    But I want to hide my IP from recipiants. I want to
    use annoymous proxy server for sending mail .Hmmm.
    I have a feeling that if I help you I am going to be finding even more emails in my inbox each morning instructing me on how I can enlarge the size of my vital organs....
    No thanks.

  • Cannot send mail from Iphone using Verizon e-mail

    I just switched from Comcast to Verizon as my internet provider, and although I can receive my Verizon e-mail on my Iphone, I can not send e-mail. I get an error "can not send mail"
    "The sender address was invalid". I have checked all the settings, and they are correct. I was able to send e-mail with the Comcast Iphone mail app, but I am unable to do so with Verizon. Can someone who is a Verizon customer and has an Iphone please shed some light on this issue?

    Verizon, like most ISPs, does not allow off-network use of it's SMTP servers (you would be able to send email when connected to your home Wi-Fi network, for example). When using 3G, you can use AT&T's SMTP server - go to Settings > Mail, Contacts, Calendars > tap the account > SMTP > AT&T SMTP Server and toggle it to ON.

  • Cannot send mail from iPhone using Godaddy account/email

    Was working perfectly until recently. Incoming mail still ok.
    Now get error message when sending mail "Cannot Send Mail - The connection to the outgoing server "smtpout.secureserver.net" failed.
    Have tried various fixes including using cwmx.com server, other ports and SSL on and off but no luck.
    Have spoken to Godaddy support but they can't help as say must be local issue with iPhone.
    Is GoDaddyGuy out there?

    SizzyB and Joe,
    I've read over your posts and see that you've both tried a few different troubleshooting steps with our support. The next step would be removing the whole email address from your iPhone and setting it back up. When you set up the email address, you should use the step by step walk through instructions available at http://help.godaddy.com/article/3423.
    SizzyB, please note that cwmx.com is an AT&T specific server. Your UK provider might list a comparable SMTP server as a default or you might need to contact them to get their settings.
    Joe, I would also like to note that you would specifically need to have our Unlimited email plan to utilize the IMAP service feature.
    If either of you have further issues, please post the full details (including any errors messages you receive) and we'll continue to work on a solution.

  • Sending mails to UWL using SO_NEW_DOCUMENT_ATT_SEND_API1 function module

    Hi all,
    is it possible to view mails send using SO_NEW_DOCUMENT_ATT_SEND_API1 function module to UWL?
    I am receving emails in my SAP Inbox.
    Please guide.
    thanks.

    Hi,
    You can only get the SAP mails into UWL notification tab with the Sonic connector (well of course with some custom development everything is possible).
    One trick to get the workflow for sending "mails" to UWL is to NOT use email sending step, but instead use a decision step in the workflow and send this work item to the user. The decision step can include the same message as the email, and have onl one option "Confirm" (or whatever). These you can easily display in UWL since they are normal work items.
    Regards,
    Karri

Maybe you are looking for