Downloading and Sending Emails

Anybody have sample code on downloading emails from a POP3 server (attachments and all). And then sending (SMTP server) those attachments to another email address.
Thanks,
Akoni

get mails like this(scratched example by me):
String password = req.getParameter("password");
String user = req.getParameter("user");
String message_number = req.getParameter("num");
// String user = new String("LOGIN_NAME");
// String password = new String("PASSWORD");
// String message_number = new String("MSG_NUMBER");
String mail_num;
String use;
String server;
String message = new String("");
String msg = new String();
String msg2 = new String();
Socket s = new Socket("mail.diganet.com", 110);
DataInputStream in = new DataInputStream(s.getInputStream());
PrintStream out = new PrintStream(s.getOutputStream());
server = in.readLine();
out.println("user " + user);
use = in.readLine();
out.println("pass " + password);
out.flush();
mail_num = in.readLine();
out.println("retr " + message_number);
msg = in.readLine();
msg2 = msg2 + " \n\r ";
msg2 = msg2 + msg;
if (".".equals(msg)) {
break;
The message will be located in msg2!
send mails like this:
SmtpClient smtp = new SmtpClient("YOUR EMAIL HOST");
smtp.from("YOUR EMAIL ADDRESS");
smtp.to(toname+"@"+tohost);
PrintStream msg = smtp.startMessage();
msg.println("From: YOUR NAME");
msg.println("To: "+toname+"@"+tohost);
msg.println("Reply-to: REPLY ADDRESS");
msg.println("Subject: "+subject);
msg.println();
msg.println(body); //where the body comes
msg.println(new Date()); // will print the date in the end of the message
smtp.closeServer();
these are examples written in 5 minutes by me so there can be some errors!
while (msg!=null) {
     

Similar Messages

  • How to create a service to UPLOAD / DOWNLOAD and send emails with files?

    Good afternoon!
    I need to create a service that sends files via email or FTP, and a service to upload / download files on a server.
    I see on the internet does not have much aid to make it in the ADF.
    Could someone send me some links, documentation, so I can get the job done?
    Thank you,
    Lewis.

    "I see on the internet does not have much aid to make it in the ADF."  - You are kidding - do you?!
    1) Google: ADF Faces file upload
    2) Google: ADF Faces image download
    3) Google: ADF send mail
    I get all the relevant hits (documentation and blog entries) by using these 3 queries in Google.
    If you mean "Web Service" by "Service" then better - just Google for Web Service and image handling to find information on this. You don't use ADF to build Web Services, which is why you need to express your search criteria different
    Frank

  • Why must I sometimes turn off WiFi to download or send email?

    I have a Droid Razr Maxx, though I don't think it's an Android or even Verizon issue. The problem, which is intermittent, and happens for my friend also on an iPhone, is that sometimes I'm not able to download or send email when connected to a Wifi hot spot. If I turn off WiFi on the phone, it then works fine using the carrier's data plan. Has anyone else experienced this problem and/or know a solution for it?
    Thanks in advance!

    Out of Office responses are best set up in the webmail account which you access using a browser.
    So check there first.
    If you set it up in Thunderbird, then you would have had to leave Computer on and Thunderbird running connected to internet all the time.
    You would have created a template email to use. This would be in the 'Templates' folder.
    You would also have set up a Message Filter to respond to emails in address book using the Template email.
    So check in Message filters for a filter that does this.
    Tools > Message filters
    or
    Menu icon > Message filters > Message filters

  • Is there a way to disable 'Save as' and 'Send Email' function in Acrobat XI?

    Hi,
    Is there a way to disable 'Save as' and 'Send Email' function in Acrobat XI?
    Thnx in advance.

    I would hope there would be no way to disable Save AS that would reduce the applicationss capability. What are you trying to prevent happening?

  • After updating to the current versions of Adobe, I can no longer scan and send emails.

    After updating to the current versions of adobe, I can no longer scan and send emails nor can I open an attachment upon receiving an email.

    Capt Camo wrote:
    After updating to the current versions of adobe...
    What exactly is "adobe"?  Adobe is the name of a company that has hundreds of software products, each with a distinct name.
    You are posting in the Flash Player forum; do you really receive emails with Flash attachments?
    Flash Player also cannot scan or send emails.
    Finally you give no information regarding your operating system, email client, etc.

  • I am having problems with my outlook 2011. While i am able to check and SEND email on all my other devices ( Ipad, iphone, Macbook), I am unable to do so with my iMac. This problem started suddenly and the error message i get is error 5.7.8. Please Help

    I  am having problems with my outlook 2011. While i am able to check and SEND email on all my other devices ( Ipad, iphone, Macbook), I am unablesend any email with my iMac ( i can recieve email) . This problem started suddenly and the error message i get is error 5.7.8. I have read the threads on line and went into settings, even created a new profile, nothing helps...Please advice..is this something to do with my keychain Access?

    As Outlook is not an Apple product, you will find more helpers familiar with Outlook here:
    Office for Mac forums

  • Reg: HRforms converted to PDF and send email to individual employee

    Hi Experts,
    The requirement is convert the HR form output to pdf and send email to respective employee in standard transaction. I copied RPCEDTX0 to  ZRPCEDTX0 and include RPCEDS09 to ZRPCEDS09, the changes need to be done for individual PERNR, I have modified the include as shown below.
       CALL FUNCTION 'HRPY_PROCESS_SET_PERNR_STATUS' after this, i have written my code
    * start of changes ARAFIQUE
      DATA: formname TYPE tdsfname VALUE 'HR_ESS_PAYSLIP_TO_PDF',
            fm_name TYPE rs38l_fnam,
            pinfo LIKE pc407 OCCURS 0 WITH HEADER LINE,
            pform type tt_pc408,
            pform_l like pc408 OCCURS 0 WITH HEADER LINE.
      IF xform[] IS NOT INITIAL.
        pform_l = xform.
        APPEND pform_1 TO pform.
        pinfo-molga = '99'.
        pinfo-forml = 'ZACC'.
        APPEND pinfo.
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
          EXPORTING
            formname                 = formname
    *       VARIANT                  = ' '
    *       DIRECT_CALL              = ' '
         IMPORTING
           fm_name                  = fm_name
         EXCEPTIONS
           no_form                  = 1
           no_function_module       = 2
           OTHERS                   = 3
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        CALL FUNCTION fm_name
          EXPORTING
            pinfo                      =
            pform                      = xform[]
    EXCEPTIONS
       FORMATTING_ERROR           = 1
       INTERNAL_ERROR             = 2
       SEND_ERROR                 = 3
       USER_CANCELED              = 4
       OTHERS                     = 5
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    * end of changes ARAFIQUE
    I found out in internet that the smartform 'HR_ESS_PAYSLIP_TO_PDF' will convert to PDF and then i can send email to PERNRS.

    Hi Experts,
    I have written the below code, the payslip is getting converted to PDF and it is getting saved in presentation server. I need to pick this file and mail, I created a customized function module for sending mail. I'm not able to send email to external addresses.
    Please find my code below. I will post the function module later.
    * start of changes ARAFIQUE
      DATA: "formname TYPE tdsfname VALUE 'HR_ESS_PAYSLIP_TO_PDF',
            "fm_name TYPE rs38l_fnam,
            p_info LIKE pc407 OCCURS 0 WITH HEADER LINE,
            "pform type tt_pc408,
            p_form LIKE pc408 OCCURS 0 WITH HEADER LINE,
            pdf_content TYPE xstring,
            pdf_fsize TYPE i,
            lv_output_length TYPE i,
            lt_binary_data TYPE STANDARD TABLE OF sdokcntbin,
            it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
            it_message LIKE solisti1 OCCURS 0 WITH HEADER LINE.
      IF xform[] IS NOT INITIAL.
        p_form[] = xform[].
        p_info-molga = '99'.
        p_info-forml = 'ZACC'.
        p_info-pcols = 1.
        p_info-psize = 1.
        APPEND p_info.
        CALL FUNCTION 'CONVERT_PAYSLIP_TO_PDF'
          EXPORTING
            p_info      = p_info
          IMPORTING
            pdf_content = pdf_content
            pdf_fsize   = pdf_fsize
          TABLES
            p_form      = p_form[]
          EXCEPTIONS
            empty_form  = 1
            OTHERS      = 2.
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
          EXPORTING
            buffer        = pdf_content
          IMPORTING
            output_length = lv_output_length
          TABLES
            binary_tab    = lt_binary_data.
        CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
              filename                        = 'C:\Test\Testing.pdf'
              filetype                        = 'BIN'
            TABLES
              data_tab                        = lt_binary_data
    *     FIELDNAMES                      =
           EXCEPTIONS
             file_write_error                = 1
             no_batch                        = 2
             gui_refuse_filetransfer         = 3
             invalid_type                    = 4
             no_authority                    = 5
             unknown_error                   = 6
             header_not_allowed              = 7
             separator_not_allowed           = 8
             filesize_not_allowed            = 9
             header_too_long                 = 10
             dp_error_create                 = 11
             dp_error_send                   = 12
             dp_error_write                  = 13
             unknown_dp_error                = 14
             access_denied                   = 15
             dp_out_of_memory                = 16
             disk_full                       = 17
             dp_timeout                      = 18
             file_not_found                  = 19
             dataprovider_exception          = 20
             control_flush_error             = 21
             OTHERS                          = 22
        it_receivers-receiver = 'gmailid'.
        it_receivers-rec_type = 'U'.
        it_receivers-com_type = 'INT'.
        APPEND it_receivers .
        it_message-line = 'Test for sending email'.
        APPEND it_message.
        CALL FUNCTION 'ZSEND_MAIL_ATTACHMENT'
          EXPORTING
            v_file_path  = 'C:\Test\Testing.pdf'
            v_subject    = 'Test Mail'
          TABLES
            it_receivers = it_receivers[]
            it_message   = it_message[].
        IF sy-subrc EQ 0.
          COMMIT WORK.
    *   Push mail out from SAP outbox
          SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
        ENDIF.

  • Notification Template  and send Email in oim 11g

    Hi All
    I need to send an email(html) format to users.I have created the a notificationtemplate through webconsole.
    I am intrested to know are there any api's available in 11 g to access this particular notification template in my java code and send email to a user using this template.
    iam referring to the class <oracle.iam.notification.vo.NotificationTemplate> and <Thor.API.OperationsInterface tcEmailOperationsIntf> classes but iam unable to access the notifcation template and send email.
    Edited by: Bipin Patil on Jul 1, 2011 12:34 AM

    Hi Rajiv Dewan
    Your link was helpful iam able to connect the the notification template.
    Now iam able to get the Template name,Subject,ID,Locale etc.
    I have one small question how to get the message from the template using this api,
    I referred the NotificationEvent,NotificationTemplate api's still iam not able to get message from my template and set message in my template.
    Is there any other API's i need to explore to get message from notification template.
    Thanks and Regards
    Bipin patill
    Edited by: Bipin Patil on Jul 1, 2011 5:29 AM

  • Someone has hacked into my account and sending emails (iCloud) pretending to be me.  I've changed my icloud password.  Do i need to do anything elase?

    Someone has hacked into my account and sending emails (iCloud) pretending to be me.  I've changed my icloud password.  Do i need to do anything else?

    You should consider enabling two-factor verification on your Apple ID, to further protect it. Without doing that, it's entirely possible that a hacker who gains access to your account in the future could take control of your Apple ID away from you entirely.
    You also should consider whether any confidential information might be stored in iCloud. If you have made the mistake of putting a list of passwords in the Notes app, for example, that list should be considered compromised, and all passwords should be changed (and removed from the Notes app).
    If you used the same password as your old iCloud password for other accounts, you need to change the password on all those accounts.
    You should also alert your contacts that your e-mail was compromised, so that they are cautious about trusting any attachments supposedly coming from you. Keep in mind that the spammer can continue to "spoof" your e-mail address on the From line of new e-mail messages, even without access to your e-mail account.

  • Converting html file into zip file and send email attaching zip file

    Hi Experts,
    I am trying to send email with attachment(html). Which contains more than 7MB. So, It is throwing an error like Size exceeded.
    So, Now i need to compress the data for less than 7MB.
    I decided to convert HTML File into ZIP File.
    Kindly suggest me to convert the HTML file into ZIP file and sending email with attached ZIP file.
    Correct answer rewarded,
    Thanks & Regards,
    N. HARISH KUMAR

    Hi Experts,
    *// HTML_TAB converting into ZIP File
       DATA  : zip_tool TYPE REF TO cl_abap_zip,
               filename TYPE string ,
               filename_zip TYPE string .
       DATA  : t_data_tab TYPE TABLE OF x255,
               bin_size TYPE i,
               buffer_x TYPE xstring,
               buffer_zip TYPE xstring.
    filename = text-007.                                                                          "'HTML_TAB
    *describe the attachment
       DESCRIBE TABLE html_tab LINES tab_lines.
       bin_size = tab_lines * 255.
       CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
         EXPORTING
           input_length = bin_size
         IMPORTING
           buffer       = buffer_x
         TABLES
           binary_tab   = html_tab.
       IF sy-subrc <> 0.
    *     message id sy-msgid type sy-msgty number sy-msgno
    *     with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
       ENDIF.
    *create zip tool
       CREATE OBJECT zip_tool.
    *add binary file
       CALL METHOD zip_tool->add
         EXPORTING
           name    = 'FSSAI_MAIL.HTML'
           content = buffer_x.
    *get binary ZIP file
       CALL METHOD zip_tool->save
         RECEIVING
           zip = buffer_zip.
       CLEAR: t_data_tab[],bin_size.
       CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
         EXPORTING
           buffer        = buffer_zip
         IMPORTING
           output_length = bin_size
         TABLES
           binary_tab    = html_tab.
    Thanks & Regards,
    N. HARISH KUMAR

  • Can I have separate Style Formatting for viewing and sending emails?

    Hey All
    I was just wondering if it was possible to have separate style settings for viewing emails sent to you and sending emails to others.
    Basically I want to set up a kind of style template for all my outgoing emails but I don't necessarily want my incoming mail to be like that if you see where I am coming from.
    Any help would be greatly appreciated.
    Thanks
    Derek

    Thanks for that.
    That would certainly be an option. However after some further investigation I came across this article which shows me exactly what I was looking for:
    http://www.apple.com/pro/tips/mail_templates.html
    But thanks for your help though. It is really appreciated.
    Derek

  • Create activity with more than partner and send email to all of them

    Hello All,
    I am working on CRM 5.0 activity management I want  to create activity with more than activity partner and send email to all of them
    Regards
    Khaled Fahim

    hi
    you can achieve this easily by creating a partner determination procedure in which you will be having more than one partner function having the function category as activity partner.
    once you created the PDP just attach this to the transaction and then call the procedure when you are actually creating an activity.
    for sending mail you can use FM
    SO_SEND_MAIL_DOCUMENT_AP1
    this is just one way
    another way is which stephen suggests
    you can use the personalised mail form functionality ,this is good in a way u neednt do any coding it will solve ur purpose in standard way.
    another way is when you create campaign and when an inbound activity is created for the every survey response
    this way you can send multiple mail and also for more than one or even n number of activity partners ,we can create the activity for the same
    best regards
    ashish

  • Any (source code)FREE BOOK  implementing recieving and sending emails

    any (source code)FREE BOOK implementing recieving and sending emails
    if avgailable on net.
    please help...
    Regards,
    Navin.

    check this out:
    http://www.javaworld.com/javaworld/jw-10-2001/jw-1026-javamail.html

  • Where do I go to stay posted on when Icloud will be up and running with respect to receiving and sending email?

    Where do I go to stay posted on when Icloud will be up and running with respect to receiving and sending email?

    http://www.apple.com/support/icloud/systemstatus/

  • HT201320 I have an Apple Ipad.  I was having problems receiving and sending emails via my yahoo email account.  I deleted the account and then tried to install it but it won't connect to server. Could you let me know what I do please?

    I have an Apple Ipad.  I was having problems receiving and sending emails via my yahoo email account.  I deleted the account and then tried to install it but it won't connect to server. Could you let me know what I do please?

    I think you have to turn off Private Browsing.
    Tap "Private" on Safari Screen to disable Private Browsing. When top of screen is white, Private Browsing is off.
    http://i1224.photobucket.com/albums/ee374/Diavonex/547958b4a8c01ac084dd6649e8386 a0f_zps12fa0cca.jpg

Maybe you are looking for

  • Installing EBS R12 in HP-UX Itanium

    Hello Experts, I'm newbie to Oracle EBS, so i have a lot of small/simple questions regarding the installation of EBS. 1. Is it possible to install EBS in HP-UX Itanium 11.31 architecture? I hope the answer is Yes, because i could able to see the down

  • How can you get the text and the box  to resize  responsibly  in Adobe Edge?

    Help please. Thank you

  • Variable to choose the currency

    Dear experts, I would like to have a mandatory variable in order for users to decide in which currency they want the price to be seen inside the query.  This variable should be seen in the entry variable screen, but in the cube I only have prices in

  • How to view videos ipad2

    Can you get QuickTime for iPad?

  • Water Damage and the Berry

    Since I joined the forum I have seen many many posts concerning water damage. When I was an admin at the LG-Dare.com forum I came across this information: http://golden-shellback.com/ For those of us who have their lives in their Blackberry it might