EMAILING FROM APPLICATION

Hi:
In our application we have created a unix shell script and SQR that combine to help us send emails from the application. It works great when we are sending text messages. However, somebody has asked us to find if we can send attachments. The SQR uses "/usr/ucb/Mail" to send emails. I was wondering if anybody out there is familiar with this executable and if they can give me a hint as to how to send file attachments. I tried differnt syntax combos and cannot make it work.
Any help would be greatly appreciated.
Thanks,
Thomas

You can try something like this:
import sun.net.smtp.SmtpClient;
SmtpClient smtp = new SmtpClient();
smtp.from("fromUser");
smtp.to("toUser");
PrintStream msg = smtp.startMessage();
msg.println();
msg.println("This is the body of the email...");
smtp.closeServer();
(This example assumes you have access to a mail server). Just one possible solution -- hope it helps!
-sheepy.

Similar Messages

  • Can i send a email from application without using exchange server?

    Hello
    I am developing a 3 tier application using EJB, JSP....and i want to incorporate the mail sending facility.
    Can i send a email from the application without using exchange server?
    plzz help!!!!
    Pavan

    You will require some kind of SMTP server to be able to send mail from your app (not necessarily M$ exchange.) Just look for mail servers for the platform of your choice.
    Vijayan

  • Sending emails from application

    Hello techies,
    I want to send emails from my application.
    Iam using java.net.*,java.util.*,java.io.*; packages upto now .
    I dont want to use javax.mail.* package.
    What is the alternative to my problem. Is there any package or class which is usefull to send mails????
    regards,
    ramu

    Sending email using SMTP and Java
    I was on a project a while ago where we needed to be able to send email notifications from the application to the administrator of the database whenever certain errors were trapped. This example shows you how. There are a few libraries that we will need to add in order to get started.
    Include the following in your project:
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.text.*;     // Used for date formatting.
    After you have added the above libraries you are ready to start to get into the good stuff!
    The first step to be able to send email it to create a connection to the SMTP port that is listening. Most of the time the SMTP port for a server is usually 25 but check with your email administrator first to get the right port.
    Here is the code to make that initial connection:
    private Socket smtpSocket = null;
    private DataOutputStream os = null;
    private DataInputStream is = null;
    Date dDate = new Date();
    DateFormat dFormat = _
        DateFormat.getDateInstance(DateFormat.FULL,Locale.US);
    try
    { // Open port to server
      smtpSocket = new Socket(m_sHostName, m_iPort);
      os = new DataOutputStream(smtpSocket.getOutputStream());
      is = new DataInputStream(smtpSocket.getInputStream());
      if(smtpSocket != null && os != null && is != null)
      { // Connection was made.  Socket is ready for use.
        [ Code to send email will be placed in here. ]
    catch(Exception e)
    { System.out.println("Host " + m_sHostName + "unknown"); }
    Now that you have made the connection it is time to add the code to send off the email. This is pretty straight forward so I will add comments into the code sample itself.
    try                       
    {   os.writeBytes("HELO\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");
        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");
        sMessage = "Your subjectline.";
        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(Exception e)
    {  System.out.println("Cannot send email as an error occurred.");  }I hope this has helped you out!
    [i code above code from someone else,  thanks to him, her ]

  • Email from Application

    From the application level, how can I send an email to an assigned resource once the 'Create' button is clicked. I have a table set up with the columns below. End user accounts have also been set up with PERSON_EMAIL as their username.
    PERSON_ID - NUMBER (pk)
    PERSON_NAME - VARCHAR2(100)
    PERSON_EMAIL - VARCHAR2(100)
    PERSON_ROLE - VARCHAR2(255)
    ASSIGNED_PROJECT - NUMBER

    Hello,
    You can create an after submit process like:
    declare
      v_body varchar2(4000);
    BEGIN
      v_body := 'Person Name: ' || :P1_PERSON_NAME;
      v_body := v_body || CHR(10) || CHR(13) || 'Email: '       || :P1_EMAIL;
      apex_mail.send(p_to => '[email protected]', p_from => :P1_EMAIL, p_body => v_body, p_subj => 'Info');
    END;--
    Regards,
    Dimitri
    http://dgielis.blogspot.com/
    http://www.apex-evangelists.com/
    http://www.apexblogs.info/

  • Email from Application to clients

    Hi, Experts
    Is there any way we can also start a process that when we receive an order and this is input to our SAP B1 then automatic email similar (not the same but similar) go to the customer automatically. Similarly once the item delivered and installed another email can do confirming all this with an attachment of the bill?
    Regards

    Hi Zubair.......
    Off course its possible. You can do it via SDK.
    You have to define some standard Email Template as per the document. So whenever you add the document
    It will send the mail alongwith PDF attachment and the Email Text will be your predefined Text.
    Regards,
    Rahul

  • Send email from within apex 2.1 application

    Hello,
    I like to send email from within apex application. I use oracle 10g xe with apex 2.1
    thx for advice
    Edited by: wucis on Feb 27, 2012 11:49 AM

    That is a very old version indeed. The documentation for sending emails from Apex 2.2 is here:
    http://docs.oracle.com/cd/B31036_01/doc/appdev.22/b28550/advnc.htm#BABJHJJF

  • File from application server-- Email ?

    Hi,
    I need to pickup a file from application server and Email the same to the intended receipents through ABAP program
    For that i had used the following code:
    REPORT  ZEMAIL_APP_SER_FAIL.
    DATA :is_doc_chng        TYPE sodocchgi1,
          it_objtxt          TYPE STANDARD TABLE OF solisti1,
          is_objtxt          TYPE solisti1,
          it_objpack         TYPE STANDARD TABLE OF sopcklsti1,
          is_objpack         TYPE sopcklsti1,
          it_objbin          TYPE STANDARD TABLE OF solisti1,
          is_objbin          TYPE solisti1,
          it_reclist         TYPE STANDARD TABLE OF somlreci1,
          is_reclist         TYPE somlreci1,
          w_lines_tx         TYPE i.
    ** Create Message Body
    **   Title and Description
    *is_doc_chng-obj_name  = 'MAIL'.
    is_doc_chng-obj_descr = 'Auto genareted Mail from Application server'.
    ** main text
    is_objtxt-line = 'This is an automatically generated mail. Please do not reply  to it.'(028).
    APPEND is_objtxt TO it_objtxt.
    is_objtxt-line = space.
    APPEND is_objtxt TO it_objtxt.
    *   write packing list (main)
    DESCRIBE TABLE it_objtxt LINES w_lines_tx.
    READ     TABLE it_objtxt INTO is_objtxt INDEX w_lines_tx.
    is_doc_chng-doc_size = ( w_lines_tx - 1 ) * 255 + STRLEN( is_objtxt ).
    CLEAR is_objpack-transf_bin.
    is_objpack-head_start = 1.
    is_objpack-head_num   = 0.
    is_objpack-body_start = 1.
    is_objpack-body_num   = w_lines_tx.
    is_objpack-doc_type   = 'CVS'.
    is_objpack-OBJ_NAME   = 'GIND_EXP'.
    is_objpack-Obj_langu  = 'E'.
    APPEND is_objpack TO it_objpack.
    is_reclist-receiver = 'XXX'@'YYY'.COM'.
    is_reclist-rec_type = 'A'.
    Break-point.
    *is_reclist-REC_ID   =  'XXX@YYY'.COM'.
    APPEND is_reclist TO it_reclist.
    CLEAR is_reclist.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
       document_data              = is_doc_chng
       put_in_outbox              = 'X'
       commit_work                = 'X'
    TABLES
       packing_list               = it_objpack
       contents_txt               = it_objtxt
       receivers                  = it_reclist
    EXCEPTIONS
       too_many_receivers         = 1
       document_not_sent          = 2
       document_type_not_exist    = 3
       operation_no_authorization = 4
       parameter_error            = 5
       x_error                    = 6
       enqueue_error              = 7
       OTHERS                     = 8.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    when i execute this program:
    I get the following error msg:
    Activation setting not yet maintained
    May i know what is the problem?

    If you are sending an email, the receiver type should be U (internet mail address type). From your code it appears that you have input it as 'A'. I am not sure if the error message is related to this. Have you checked in transaction SOST, whether an email has been triggered from your program? At what point of execution is this error message triggered?

  • Sending EMail "Text-File" from Application Server!

    Hi Experts,
    how can I sending a Text-File from Application Server via Email?
    Is there existing a Function Modul?
    With Kind regards
    Ersin
    Moderator message: sending emails = FAQ, please search before posting.
    Edited by: Thomas Zloch on Nov 25, 2010 4:23 PM

    STF (Search the forum)!  This type of question has been asked...and answered....many times.

  • Sending an Email by taking excel sheet from Application Server.

    Hi.
    I Searched in SDN related 'Sending an Email by taking excel sheet from Application Server'.
    But i didnt get. I got sending mails from local pc.
    Can some bdy provide me sample code how to send mail with an attachment. the attached file should get from Application Server
    Regards,
    Renu

    Hi,
    For writing data to app server from internal table:
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/prog%252bon%252bopen%252bdataset%252binput
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/prog%252bon%252bopen%252bdataset%252boutput
    Checkout this wiki for sending XL in mail attachment:
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/multiple%252battachment%252bon%252be_mail
    Thanks,
    Krishna

  • When I delete an email from my hotmail account in the 'mail' application on my MacBook Pro, it is not deleted from the same 'mail' application on my iPhone 4s which my hotmail account has also been added. I thought my emails were synced over iCloud?

    It is so frustrating because I cannot understand what is wrong. When I add an event to my calender on my iPhone it appears in my calender on my MacBook which is perfect and very convenient. The same thing occurs with reminders; everything syncs perfectly here. However when I delete an email from my MacBook from the 'mail' appliaction it doesn't delete from the same built-in application on my iPhone. This is extremely frustrating as I have to delete the same email twice on two different devices. I'd appreciate any feedback that would help resolve this problem!

    Calendars (and contacts) can "sync" between your MBP and your iPhone through iCloud because they really live on the iCloud servers and the two devices are clients. iCloud can accomplish much the same trick for email messages because the email really resides on iCloud email servers.
    If the email resides on some other server, that server is responsible for whatever syncing will be done. IMAP servers like the iCloud servers are built for such syncing; other mail servers may or may not be. iCloud would not be involved with email other than iCloud email.
    I understand Hotmail has been changing how their email servers are accessed. Check with Hotmail support for any changes you may need to make to keep up.

  • Error when sending email from a web application that runs on GlassFish

    Hello all, I hope some can give me some hints on how to fix this problem.
    I have a web application built in Java that runs on GlassFish v3.
    The application uses a mail plugin that makes use of mail.jar
    Whenever I try to use the plugin to send an email out I get an error.
    The application is programmed to send emails from a gmail account, and I believe there is a problem with the SSL version that Googlemail is expecting.
    By the way, everything works fine if I run the web app on other servers like Jetty or Apache.
    The stacktrace I get from the log when the error occurs is as follows:
    INFO: 2009-05-08 19:48:57,500 [httpWorkerThread-8080-0] ERROR errors.GrailsExceptionResolver - org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
    nested exception is:
    java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
    org.codehaus.groovy.runtime.InvokerInvocationException: org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
    nested exception is:
    java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:431)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:337)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:218)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:218)
    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:883)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:732)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:554)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:485)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:377)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:218)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:218)
    at org.jsecurity.web.servlet.JSecurityFilter.doFilterInternal(JSecurityFilter.java:382)
    at org.jsecurity.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:180)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:218)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:218)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:218)
    at org.apache.catalina.core.StandardWrapperValve.preInvoke(StandardWrapperValve.java:460)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:139)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:186)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:96)
    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:187)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:651)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1030)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:142)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:651)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1030)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:242)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:180)
    at com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:633)
    at com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:570)
    at com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:827)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:152)
    at com.sun.enterprise.v3.services.impl.GlassfishProtocolChain.executeProtocolFilter(GlassfishProtocolChain.java:71)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:103)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:89)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56)
    at com.sun.grizzly.util.WorkerThreadImpl.processTask(WorkerThreadImpl.java:325)
    at com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:184)
    Any help would be really appreciated... honestly I'm pretty stuck.
    Alex

    Hi Alex,
    Since I had a Gmail test servlet kicking around, I ran it on the latest V3 nightly build.
    On the first run, I encountered the following nested exceptions:
    javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465
    --> java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
        --> java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
            --> java.security.UnrecoverableKeyException: Password must not be nullThe UnrecoverableKeyException is a manifestation of [https://glassfish.dev.java.net/issues/show_bug.cgi?id=6938|https://glassfish.dev.java.net/issues/show_bug.cgi?id=6938]
    I worked around this by adding the following JVM config options to domain.xml
    <jvm-options>-Djavax.net.ssl.keyStorePassword=changeit</jvm-options>
    <jvm-options>-Djavax.net.ssl.trustStorePassword=changeit</jvm-options> (Note: the default master password is "changeit")
    These lines are placed in /domain/configs/config/java-config of domain.xml for the particular server config you're using. There's only one server config in the default domain.xml shipped with V3. Then restart the server.
    I retested the code on both port 465 and 587, with and without the above config changes. Without the change, they both fail the same way, and with the change, they both work. Let me know if this helps.
    -Peter

  • Sending emails from the JSP application

    hi,
    I am trying to send emails from my jsp application using JavaMail API's.
    I am using my own mailserver.
    Iam able to send emails from my applications to the ids of my own mailserver but not the yahoo,gmail and rediff ids.
    Is it because of blocking of any firewall or somthing else to do within my application?
    Can anyone help me in this?
    Thanks a lot.

    Please read the JavaMail FAQ.
    It's probably due to the configuration of your mail server,
    which is refusing to relay your messages.

  • My "mailto" is missing from applications and I can't email from websites.

    When I click to send an email from a website, nothing happens. I checked FireFox help and was told to go to Tools > Options > Applications > Mailto and select my email server. Unfortunately, there is no Mailto in the application list.

    Hi, i had the same problem. Try to find the file "apple" or "itunes" don't know it anymore exactly. Ahm well you need to delet any information or just plug in your iphone into an other computer. important is that your iphone never has been pluged in this computer before. This was what i did, and it worked!

  • When I click a link in email from the dock I get "no associated application can be found but if I used comcast email it goes through does anyone know how I can enable these links on my dock email?

    When I click a link in email from the dock I get "no associated application could be found", however if I used comcast email the link will open.Does anyone know how I can enable the links to open in my apple email account on the dock?

    Barney,
    I have four groups.
    I just typed the name of one of those groups in the To field on the iPhone's email, and received:
    Invalid Address
    "<group name>" does not appear to be a valid email address.  Do you want to send it anyway?
    I clicked continue and it remains in my outbox.
    Help is appreciated.
    Thanks,
    Michael

  • I am switching accounts with my brother (long story why) but I need to remove my emails from the Mail application. I removed my Gmail account but when I try to remove my iCloud email it still keeps the emails. Does anyone know to remove a iCloud email?

    I am switching accounts with my brother (long story why) but I need to remove my emails from the Mail application. I removed my Gmail account but when I try to remove my iCloud email it still keeps the emails. Does anyone know to remove a iCloud email?

    Hi, how are you seeing these eMails if the account is removed?

Maybe you are looking for

  • Recording from vcr

    My 17 in G4 powerbook has svideo which allows me to watch movies on my tv. Question is, is this svideo conection in and out? I'd like to use it to record from my VCR to digitize some of my older vhs footage. Peter

  • Ipod not showing up on itunes or my computer.it recharges when i connect it

    Ipod not showing up on itunes or my computer.it recharges when i connect it but it dosent show up under devices so i cant sync any music!!the screen on the ipod would usually say "connecting"or"do not disconnect"but it dosent say that anymore!!Ive be

  • Sort by time only is it possible?

    If I import images taken on two different cameras which have synchronised time and  I use the sort by time and date function  LR3 does that but separates the images into two groups sorted by time ,each group is in the time order but for each camera m

  • Problem with website db

    I have dedicated server. the following is the status: # Begin of O R A C L E status section # Kernel Parameters Shared memory: SHMMAX= 3294967296 SHMMNI= 4096 SHMALL= 2097152 Semaphore values: SEMMSL, SEMMNS, SEMOPM, SEMMNI: 1250 32000 100 256 Databa

  • Multi-page form help!

    Hello Forum, I'm a brand new user to ES Designer and am trying to complete my first form. I've got to grips with the drop downs/cells/buttons etc. However how do I make a form span three pages? I need more space than just one page, but when I publish