Arabic characters issue in smtp email csv attachment

Hi all,
the below email extracts the output of a query and sends it as an attachment in csv format.
but the arabic characters are coming as question marks in the attachment, can someone kindly help, below is hte code
procedure test   is
        smtp    UTL_SMTP.connection;
        reply   UTL_SMTP.reply;
                      csvContent      clob;---added
        procedure W( line varchar2 default null ) is
        begin
                UTL_SMTP.write_data(
                        smtp,
                        line || utl_tcp.CRLF
        end;
begin
        smtp := UTL_SMTP.open_connection('test.domain.com',25);
        --// IMPORTANT: specify the hostname of the plaform sending the mail!
        UTL_SMTP.helo( smtp,'test.domain.com');
        UTL_SMTP.mail( smtp,'[email protected]' );
       UTL_SMTP.rcpt( smtp,'[email protected]' );
        UTL_SMTP.open_data( smtp );
        --// mail header
        W( 'MIME-Version: 1.0' );
        W( 'Content-Type: multipart/mixed; boundary="----_=_NextPart_001_01C87DCB.CD85F300"');
        W( 'Subject: test' );
        W( 'From: test' );
        --// mail text body
        W();
        W( '------_=_NextPart_001_01C87DCB.CD85F300' );
        W( 'Content-Transfer-Encoding: 8bit' );
        W( 'Content-Type: text/plain' );
         W( 'Charset: AL32UTF8' );
         W();
        W( 'Dear All' );
        W();
        W( 'test' );
        W();
        --// mail attachment
        W();
        W( '------_=_NextPart_001_01C87DCB.CD85F300' );
        W( 'Content-Disposition: attachment; filename="test.csv"' );
        W( 'Content-Type: text/plain' );      
        W( 'Charset: AL32UTF8' );   
        W();
        W( 'EMPNO'||','||'ENAME       );
        for c in( SELECT EMPNO,ENAME FROM EMPLOYEES ) loop
                W( c.EMPNO||','||c.ENAME  );
        end loop;
        W( '------_=_NextPart_001_01C87DCB.CD85F300' );
        UTL_SMTP.close_data( smtp );
        UTL_SMTP.quit( smtp );
end;

thanks srini, i am using microsoft excel,
i think it is a character conversion issue, i had tested by sending the below message without charset=AL32UTF8 and arabic was displayed as junk, after giving the value of charset its working.
begin
utl_mail.send(
sender => '[email protected]',
recipients => '[email protected]',
subject => 'Subject',
message => 'إلاق فرع (ح',
mime_type => 'text; charset=AL32UTF8');
end;I think in the code i am not passing charset value correctly, can you kindly tell me where i can give the charset in the below code
procedure test   is
        smtp    UTL_SMTP.connection;
        reply   UTL_SMTP.reply;
                      csvContent      clob;---added
        procedure W( line varchar2 default null ) is
        begin
                UTL_SMTP.write_data(
                        smtp,
                        line || utl_tcp.CRLF
        end;
begin
        smtp := UTL_SMTP.open_connection('test.domain.com',25);
        --// IMPORTANT: specify the hostname of the plaform sending the mail!
        UTL_SMTP.helo( smtp,'test.domain.com');
        UTL_SMTP.mail( smtp,'[email protected]' );
       UTL_SMTP.rcpt( smtp,'[email protected]' );
        UTL_SMTP.open_data( smtp );
        --// mail header
        W( 'MIME-Version: 1.0' );
        W( 'Content-Type: multipart/mixed; boundary="----_=_NextPart_001_01C87DCB.CD85F300"');
        W( 'Subject: test' );
        W( 'From: test' );
        --// mail text body
        W();
        W( '------_=_NextPart_001_01C87DCB.CD85F300' );
        W( 'Content-Transfer-Encoding: 8bit' );
        W( 'Content-Type: text/plain' );
         W( 'Charset: AL32UTF8' );
         W();
        W( 'Dear All' );
        W();
        W( 'test' );
        W();
        --// mail attachment
        W();
        W( '------_=_NextPart_001_01C87DCB.CD85F300' );
        W( 'Content-Disposition: attachment; filename="test.csv"' );
        W( 'Content-Type: text/plain' );      
        W( 'Charset: AL32UTF8' );   
        W();
        W( 'EMPNO'||','||'ENAME       );
        for c in( SELECT EMPNO,ENAME FROM EMPLOYEES ) loop
                W( c.EMPNO||','||c.ENAME  );
        end loop;
        W( '------_=_NextPart_001_01C87DCB.CD85F300' );
        UTL_SMTP.close_data( smtp );
        UTL_SMTP.quit( smtp );
end;

Similar Messages

  • Arabic Characters Issue

    Hi
    Following is our environment
    DB Version: Oracle 11g R2 (11.2.0.3.0) 64bit
    OS : OEL 5U2
    Characterset: AMERICAN_AMERICA.AR8MSWIN1256
    We have an opensource application built on php. CHARSET was defined as AR8MSWIN1256 in the configuration file. Data was inserted using browser based interface. Use access the system using IE 8 since it is web based application. Data comprise of both Arabic and English. It is displayed perfectly fine using browser ie Arabic shows proper Arabic characters and English shows correct English.
    Problem started when a requirement came to generate some reports using Oracle Reports 10g. Arabic data show as garbage in the reports. Vendor was asked to provide some solution. They suggested to change the CHARSET to AL32UTF8 in the config file of the application. After making the changes, the new data that is inserted in the database can be seen correctly for both languages regardless of the tool (be it SQLDeveloper or Oracle Reports). The old data, however, shows garbage. Surprisingly when data is extracted using scripts in flat files and then imported in the test database after setting environment variable NLS_LANG=AMERICAN_AMERICA.UTF8 using @/../filename.sql, it converts it properly. Since data is huge and this is taking way too much time, I was hoping if someone could help me in quickly perform this migration? Already tried CSSCAN/CSALTER and DMU but did not succeed. DMU stopped at 5th stage when it was supposed to issue ALTER DATABASE CHARACTER SET command.
    Currently I am installing database with AL32UTF8 characterset and planning to import the schema in it. Is my approach correct? Any help will be highly appreciated.
    Thank you
    myuser@DB>select dump(name,1016) from  mytable where id like '1';
    DUMP(NAME,1016)
    Typ=1 Len=28 CharacterSet=AR8MSWIN1256: d9,81,d8,b1,d9,8a,d9,82,20,d8,b9,d9,85,d9,84,20,d8,a7,d9,84,d9,82,d8,b7,d8,a7,d8,b9
    myuser@DB>select dump(name,1016) from  mytable where id like '2';
    DUMP(NAME,1016)
    Typ=1 Len=93 CharacterSet=AR8MSWIN1256: d8,aa,d8,b9,d8,a7,d9,85,d9,8a,d9,85,20,d9,85,d9,86,20,d8,a7,d9,84,d9,85,d8,af,d9,8a,d8,b1,20,d8,a7,d9,84,d8,aa,d9,86,d9,81,d9,8a,d8,b0,d9,8a,20,d9,84,d9,84,d9,82
    myuser@DB>select value from NLS_DATABASE_PARAMETERS where parameter LIKE '%CHARACTERSET';
    VALUE
    AR8MSWIN1256
    UTF8Edited by: user560883 on May 4, 2012 3:34 AM
    Edited by: user560883 on May 4, 2012 3:39 AM

    Hi Sergiusz
    Firstly I would like to thank you for replying.
    Secondly I was able to move further with the DMU (the issue was due to more sessions that I had to kill to allow DMU to proceed with ALTER DATABASE CHARACTER SET command).
    Here is what I have done so far without any luck.
    1) Created a test instance with source database characterset ie AR8MSWIN1256 and performed a full import using DataPump (impdp).
    2) Used DMU to perform conversion/migration to AL32UTF8. (this step took almost 5 hours).
    3) Used SQLDeveloper to verify the results and data still show as garbage.
    Thing that worked for me but is way to slow and not reliable.
    1) Save data in file (.sql) using Windows XP client or windows 2003 server. Basically I am generating the whole SQL statements for UPDATE eg UPDATE table SET xx)
    2) SET NLS_LANG=AMERICAN_AMERICA.UTF8 on command prompt of Windows XP client and use SQLPLUS to open sql prompt.
    3) Use @path\file.sql (that was generated in earlier step) to update records.
    4) Verify via SQLDeveloper that arabic shows correctly.
    Issue with above approach is since we have millions of records stored in multiple tables, sometimes while generating the file with SQL Statements, the server CPU touch 100% and then freeze. Also file size grow exponentially and to verify how much of the work was done prior to freezing becomes very difficult.
    I still have the DB after using the DMU tool intact so if you could think of some other workaround that will be great.
    Again, thank you for helping me with this.

  • Problem with chinese characters while sending mail with .CSV attachment

    Hi,
    i am sendin .CSV file as an attachment with mail using "SO_DOCUMENT_SEND_API1" FM,
    whle opening the mail attachment the chinese characters are not displaying properly.
    currently i am using ECC 5.0
    can any body help in this regard.
    Thanks,
    Rahim

    Hi Kang Ring,
    please convert the content of the attachement into the binary format and then add it as a mail attachment.
    LOOP AT i_data ASSIGNING <wa_data>.
    if s_output is INITIAL.
    CONCATENATE <wa_data> cl_abap_char_utilities=>cr_lf into s_output.
    else.
    CONCATENATE s_output <wa_data> INTO s_output SEPARATED BY cl_abap_char_utilities=>cr_lf.
    endif.
    ENDLOOP.
    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
    EXPORTING
    text = s_output
    IMPORTING
    buffer = x_output.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
    EXPORTING
    buffer = x_output
    TABLES
    binary_tab = imail_att.
         OR
    please use ABAP-Object classes like CL_BCS , CL_document_BCS.....
    please findthe below sample code.
      cl_bcs_convert=>string_to_solix(
              EXPORTING
                iv_string   = s_output
                iv_codepage = '4103'          "suitable for MS Excel, leave empty
                iv_add_bom  = 'X'               "for other doc types
              IMPORTING
                et_solix  = s_output_binary  "(of type solix_tab)
                ev_size   = size ).
    attachment->add_attachment(                       "attachment of type ref to cl_document_bcs
              i_attachment_type    = 'xls'                     
              i_attachment_subject = l_subject    
              i_attachment_size    = size
              i_att_content_hex    = s_output_binary ).
    you need to write the code for adding the receipents, subject and adding this "attachment " as an attachment to the mail.
    Hope this will helps to you....,
    thanks,
    Rahim.

  • Greater than 255 characters not allowed - CSV attachment

    While sending the data as a CSV attachemnent, its not allowing more than 255 characters per line.
    I want to send more than 255 characters in a line  (in the CSV attacment. how to do this ?
    The function module which i used is
    SO_new_document_att_send_appi1.
    or else suggest me a function module used to send csv attachement more than 255 characters in a line
    Thanks

    Check below code and adjust your code for compress/decompress...
      DATA : l_email_title TYPE sood1-objdes.
      DATA : l_file_name TYPE soobjchgi1-obj_descr.
      DATA : lit_email_receiver TYPE zphr1_email_tab.
      DATA : lit_email_msg LIKE soli.
      DATA : lit_attachment LIKE soli.
      DATA: l_lines LIKE sy-tabix,
             l_msg_lines LIKE sy-tabix.
    Creation of the document to be sent
      CLEAR:  l_email_title,
              l_file_name,
              lit_email_receiver,
              lit_email_msg,
              lit_attachment,
              gf_doc_chng,
              it_objtxt,
              it_objbody,
              it_objpack,
              it_objhead,
              it_reclist.
      REFRESH: it_objtxt,
               it_objbody,
               it_objpack,
               it_objhead,
               it_reclist.
    *Passing mail subject
      gf_doc_chng-obj_name =  text-035.
      gf_doc_chng-obj_descr = text-036.
    Fill the document data.
      gf_doc_chng-doc_size = 1.
    Populate the subject/generic message attributes
      gf_doc_chng-obj_langu = sy-langu.
      gf_doc_chng-obj_name  = c_saprpt.
      gf_doc_chng-sensitivty = c_value_f.
    Fill the document data and get size of attachment
    DESCRIBE TABLE it_output_soli LINES l_lines.
      gf_doc_chng-doc_size =
          ( l_lines - 1 ) * 255 + STRLEN( it_output_soli ).
      gf_doc_chng-obj_langu  = sy-langu.
      gf_doc_chng-obj_name   = c_saprpt.
      gf_doc_chng-sensitivty = c_value_f.
    *Passing text for mail body
      it_objbody = space.
      APPEND it_objbody.
      CLEAR  it_objbody.
      it_objbody =  c_hi.
      APPEND it_objbody.
      CLEAR  it_objbody.
      it_objbody = space.
      APPEND it_objbody.
      CLEAR  it_objbody.
      it_objbody = text-036.
      APPEND it_objbody.
      CLEAR  it_objbody.
      it_objbody = space.
      APPEND it_objbody.
      CLEAR  it_objbody.
      it_objbody = c_thanks.
      APPEND it_objbody.
      CLEAR  it_objbody.
      it_objbody = space.
      APPEND it_objbody.
      CLEAR  it_objbody.
      DESCRIBE TABLE it_objbody LINES l_msg_lines.
      READ TABLE it_objbody INDEX  l_msg_lines.
      gf_doc_chng-doc_size = ( l_msg_lines - 1 ) * 255 + STRLEN( it_objbody
    Creation of the entry for the compressed document
      it_objpack-transf_bin = ' '.
      it_objpack-head_start = 1.
      it_objpack-head_num = 0.
      it_objpack-body_start = 1.
      it_objpack-body_num = l_msg_lines.
      it_objpack-doc_type = c_doc_type.
      APPEND it_objpack.
      CLEAR it_objpack.
      LOOP AT it_output_soli.
        it_objtxt = it_output_soli.
        APPEND it_objtxt.
        CLEAR it_objtxt.
      ENDLOOP.
    Passing the heading of the report
      it_objhead = text-037.
      APPEND it_objhead.
      CLEAR it_objhead.
    *To compress the table to size of 255 characters
      CALL FUNCTION 'TABLE_COMPRESS'
        TABLES
          in  = it_objtxt
          out = it_comprsd.
      IF sy-subrc <> 0.
      ENDIF.
    To decompress the compressed table
      CALL FUNCTION 'TABLE_DECOMPRESS'
        TABLES
          in  = it_comprsd
          out = it_decomprsd.
      IF sy-subrc <> 0.
      ENDIF.
    Creation of the document attachment
      CLEAR : l_msg_lines,l_lines.
      DESCRIBE TABLE it_decomprsd LINES l_lines.
      IF l_lines <> 0.    "Don't create attachment if no data is present
    Creation of the entry for the compressed attachment
        it_objpack-transf_bin = c_value_x.
        it_objpack-head_start = 1.
        it_objpack-head_num = 1.
        it_objpack-body_start = 1.
        it_objpack-body_num = l_lines.
        it_objpack-doc_type = c_excel.
        it_objpack-obj_name = sy-repid.
        it_objpack-obj_descr = text-036.
        it_objpack-doc_size =  l_lines * 255.
        APPEND it_objpack.
        CLEAR it_objpack.
      ENDIF.
      LOOP AT s_email.
        it_reclist-receiver = s_email-low.
        it_reclist-rec_type = c_rec_type.
        it_reclist-express  = c_value_x.
        APPEND it_reclist.
      ENDLOOP.
    *Passing maild of the user(who runs the report)
    with extension @eur.appliedbiosystems.com
      CLEAR it_reclist.
      CONCATENATE sy-uname text-031 INTO it_reclist-receiver.
      it_reclist-rec_type = c_rec_type.
      it_reclist-express  = c_value_x.
      APPEND it_reclist.
    with extension @applera.com
      CLEAR it_reclist.
      CONCATENATE sy-uname text-032 INTO it_reclist-receiver.
      it_reclist-rec_type = c_rec_type.
      it_reclist-express  = c_value_x.
      APPEND it_reclist.
    *Sending mail with attachment
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = gf_doc_chng
          put_in_outbox              = c_val
          commit_work                = c_val
        TABLES
          packing_list               = it_objpack
          contents_bin               = it_decomprsd
          contents_txt               = it_objbody
          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 IS NOT INITIAL.
        WRITE: / text-034.
      ELSE.
        WRITE: / text-033.
      ENDIF.

  • SMTP Multiple emails with attachements Powershell

    Hello guys, my first post here and I was hoping someone could help me a little bit. I was working on a powershell project that sends an email with multiple attachements from a directory. Filenames i this directory will change all the time. My code so far
    is:
    #Connection Details
    $username=”[email protected]
    $password=”xxxxxxxx”
    $smtpServer = “smtp.gmail.com”
    $msg = new-object Net.Mail.MailMessage
    #Change port number for SSL to 587
    $smtp = New-Object Net.Mail.SmtpClient($SmtpServer, 587) 
    #Uncomment Next line for SSL  
    $smtp.EnableSsl = $true
    $smtp.Credentials = New-Object System.Net.NetworkCredential( $username, $password )
    #From Address
    $msg.From = "[email protected]"
    #To Address, Copy the below line for multiple recipients
    $msg.To.Add(“[email protected]”)
    #Message Body
    $msg.Body=”Please See Attached Database Files”
    #Message Subject
    $msg.Subject = “DATABASE”
    write-host "SENDING FILES"
    #your file location
    $files=Get-ChildItem “C:\CM\Send\”
    Foreach($file in $files)
    Write-Host “Attaching File :- ” $file
    $attachment = New-Object System.Net.Mail.Attachment –ArgumentList C:\CM\Send\$file
    $msg.Attachments.Add($attachment)
    $smtp.Send($msg)
    $attachment.Dispose();
    $msg.Dispose();
    write-host "Mail Sent Successfully"
    And this code works just fine for this, then I realize that gmail only has 25 MB max attachement size and the files I want to send is around 18 mb. 
    Anyone have any good ideas to split all files in the directory into seperate emails. i.e one email per file? Having trouble doing so because the filenames keep changing daily.
    I am a beginner in this kind of language, but anything will help to get me on the right track :-)
    Thank you.

    Hi Christopher,
    welcome to Technet!
    One piece of advice right away: The Technet forums have a great functionality to post code ("Insert Code Block"). Using it will get you something like what I've posted below.
    If you know that each of your files will be smaller than your limit, you may be able to get away with this:
    #your file location
    $files = Get-ChildItem "C:\CM\Send"
    Foreach($file in $files)
    Write-Host "Attaching File :- " $file
    $attachment = New-Object System.Net.Mail.Attachment –ArgumentList $file.FullName
    $msg.Attachments.Add($attachment)
    $smtp.Send($msg)
    $msg.Attachments.Clear()
    What this does is get all files in the folder, and for each file, it attaches it to the mail, sends the mail and then clears the attachments.
    Cheers,
    Fred
    There's no place like 127.0.0.1

  • Emailing IR results as CSV attachment

    Hello All,
    I have a requirement to email IR results as a CSV attachment.
    I can get the SQL for the IR by querying APEX_APPLICATION_PAGE_IR.SQL_QUERY but that is just the "base" query and doesn't include computed column. It also includes columns I may have have chosen to suppress. How can I reference the "current" IR filter??
    I think once I can construct the SQL statement to match the current IR display, I can save it as a blob and the construct and send the email and attachment using APEX_MAIL.SEND and APEX_MAIL.ADD_ATTACHMENT.
    So, is this the desired approach? Or is there an easier way to email the results of an IR in CSV format?
    Thanks,
    Monty

    Hi Monty,
    In Apex 4.1 (not sure about earlier versions) if you go to "Download" under the "Actions" drop down you will get an option for email. Obviously you will have to have the email service set up in Apex for it to work. This sends the report as an HTML attachment, I'm not sure if this can be tweaked to send as CSV. Obviously you could down load the results as a csv and then mail them manually.
    Regards
    Andre

  • Msg say SMTP Server timed out when sending email w/attachment; otherwise sends fine.

    I have problems when sending an email with attachments (generally pdf). I get the error msg stating my smtp server connection has timed out. I can 'sometimes' reboot after saving the email, once restarted I can open the draft and it will go... sometimes not. I test the smtp server by immediately sending a 'test' email without any attachments and it will go right through. Open the saved draft and attempt to resend and it will fail. SMTP settings are correct and have not changed in several years and have not experienced any problems until this latest update to Thunderbird. I can use the same account at Go daddy's web mail application, send the same email with the identical attachment and it works correctly... so I don't think it is the 'attachment' or it's size. I can send 'test' emails to myself or my wife's account and everything works correctly during the session until I attempt to send an email with the attachment and it fails. Immediately send another 'test' email without attachment to the same account and it will go through. I am at a loss as to what to do next to correct this. I am contemplating an uninstall and re-install. No new software has been added to this computer and this problem just recently popped up. I'm stumped...

    This sounds like more McAfee funny stuff. But it could be any anti virus really. Disable attachment scanning on outgoing mail and you should be good to go.

  • Canu2019t view Chinese characters in a PDF email attachment sent via SAP.

    Canu2019t view Chinese characters in a PDF email attachment sent via SAP.
                     When open the Chinese characters come out funny.
                     Note: The document looks okay when previewed in SAP.
    Tried the following:
    FM CONVERT_OTF_2_PDF
    CNSONG is one of our u201CSystem fontsu201D
    Attempted with both ZH(Chinese simplified) and ZF(Chinese traditional) languages
    Tried using a printer that is set up as u201CDevice Typeu201D PDF1
    Tried using a printer that is set up as u201CDevice Typeu201D ZHKPDF
    Tried passing device type as u201CCNSAPWINu201D
    The following ADODE software was loaded: Chinese simplified, Chinese traditional,
                                                                              Korean and Japanese

    Hi,
    As a try, can you check this.
    SET COUNTRY 'CN'. China country code.
    SET LOCALE LANGUAGE 'CN'.
    Thanks,
    Vinod.

  • IOS4 SMTP email setup issues

    IOS4 woes.... Had the "spectacular" experience of updating our Gen2 Itouch to IOS4. Email to our Verizon email account used to work flawlessly. I've sunk about 4 hours and finally got the unit to send email {receiving was never an issue} by creating a second SMTP email account, but outbound emails take 15 minutes to send {when they used to take only 10 seconds, great improvement Apple....}. How do I shut off the DEFAULT Apple / Yahoo account and use the secondary email server as the PRIMARY account?
    thank you for your help....Arrrrg {I'm a pirate!}

    I was having the same problem with outbound email not working after upgrading my 3GS to OS4.0. The only solution that I found was to disable my existing mail accounts and create new ones. Go to Settings->Mail. Select the mail accounts that don't work properly and set them to Account->OFF. Then select Add Account from the Settings->Mail screen and create a new one. I set two mail accounts that weren't sending mail to OFF, then recreated them with Add Account. They both work perfectly fine now.

  • Z10 SMTP Email Sending Issues

    Hello
    Could you let me know if you have a workaround for the issue with not being able to send SMTP emails from the new Blackberry Z10 on build 10.0.10.82
    The message I get is 'Protocol Layer was unable to send a message'
    There is an ever growing discussion on the message boards….
    http://forums.crackberry.com/blackberry-z10-f254/unable-send-some-e-mails-protocol-layer-unable-send.../
    http://forums.crackberry.com/blackberry-z10-f254/heads-up-email-bug-recent-z10-os-versions-779341/
    http://forums.crackberry.com/blackberry-z10-f254/cant-send-e-mail-via-smtp-z10-785848/
    I have tried the following;
    Using a different port for smtp (currently using 465 with SSL)
    Tried turning SSL off and using port 25
    Tried using a local smtp from my service provider (Etisalat raher than auth.smtp.1and1.co.uk)
    Using a different email
    None of the above work.
    Any assistance much appreciated...

    6hugo9 wrote:
    Yes please -- it's annoying that March-2013 update has introduced such a crippling facility.
    I have IMAP and Exchange accounts setup, and all of my email accounts suffer this problem every day ..
    Quite dibilitating - and not good when this is my primary communication device... I dont look forward to having to resort to an Android based phone if this doesnt get fixed fairly soon 
    Regards
    @6hugo9 - I think that you are talking about two seperate issues, unless you are also using 1&1 as your email provider.
    @jjclarke - The 1&1 issue looks like it is being looked into, there is a KB article here. That said, the more of you that call into your Carrier's Blackberry support teams and report the issue, the more likely you are to get it resolved. You may even find that there is already a resolution in the pipeline waiting for Carrier's to OK the release of the updated software?
    @6hugo9 - you are listing a number of seperate issues in your linked threads. There is a bug that shows up on some servers over SMTP that the z10 is botching the HTML encoding on the emails (fortunately my server are not having this issue, knock on wood!), also others are having issues with ports being blocked (port 25 is quite frequently blocked by ISPs for anti-spam reasons) which would stop email from being sent.. as you wouldn't be able to connect to your server.
    Regardless, the best way to get to the bottom of that issue is also to call your carrier's Blackberry support team.. that will get the issue escalated on the development side. The "more the merrier", so to speak.
    A little birdie told me that when that SMTP encoding bug was introduced, the Blackberry support teams were swamped with calls.. So one has to assume that the devs were then working hard on resolving the issue. I imagine that we are all now waiting on our carriers for the fix to be sent through after they get done with the Carrier's "OS tests" that are always delaying our software updates.
    Best bet is always to call in and get a resolution, especially for extremely important issues like this one.
    -: DrewRead :-
    Can't find an app on Blackberry World yet? Tweet the developer and ask when they will #GetWithBB10 !!
    "Like it" if you like it.

  • OUTGOING SMTP Email issue on N900

    Hi All
    I have setup my n900 with my POP3/SMTP email settings to enable me to send and receive my emails but I am having the following problem:
    Incoming emails are received fine without any issues at all (in full html too, which I really like).
    But.. I can't SEND outgoing emails when I am using the WIFI connection at my house. However as soon as I connect to the VODAFONE GPRS connection, I can send email without any problem.
    Am I right to assume that because I can at least send whilst in the GPRS connection I must have set smtp up correctly?
    Can anyone offer any assistance please?
    Cheers
    John.
    Solved!
    Go to Solution.

    use these:
    POP server: pop3.live.com (Port 995)
    POP SSL required? Yes
    User name: Your Windows Live ID, for example [email protected]
    Password: The password you usually use to sign in to Hotmail or Windows Live
    SMTP server: smtp.live.com (Port 25) {Note: If port 25 has been blocked in your network or by your ISP, you can set SMTP port to 587 with TLS or SSL Encryption depending on the client in use}
    Authentication required? Yes (this matches your POP username and password)
    TLS/SSL required? Yes

  • How to Extract .CSV attachment from Email

    We have a working scenario for (.csv)File to R/3 via ABAP Proxy. The file is currently placed on the application server manually. It will soon start arriving by e-mail as an attachment. Is it possible to use XI to detach the .csv attachment and place the file on the server ? Required process is Email -> File -> XI -> R/3

    Shawn,
    You can do a EMAIL -- XI -- File to send the file to the Target directory.
    To extract the file from the Mail Attachment, you need to use the Payload Swap Bean .
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/bf37423cf7ab04e10000000a1550b0/content.htm
    Regards,
    Bhavesh

  • HOW TO SEND A HEBREW EMAIL WITH ATTACHMENT USING DEMO_MAIL

    Hello All,
    This is Not a question , just attaching something I've implemented and might be interesting for few of us,
    This package I'm attaching allows to send Hebrew Language email + attaching files to it.
    This package is based on demo_mail package (combined here but you can search at google for more example information if needed).
    My Package is supplied as is , for any specific information regarding it , please contact me directly at : [email protected] or POST here.
    * Please also note , that this package allow file to be attach via URL (meaning you will have to define a link to this file, if you would like to implement a link to a local file , e.g : c:\temp\myfile , you will have to customize the package your self with database directories option etc ...)
    First I will attach an example of how to use it :
    ==================================
    begin
    demo_mail_heb.send_html_mail_attach(p_sender => '[email protected]',
    p_recipients => '[email protected]',
    p_subject => 'שלום וברכה עולם',
    p_data => '<hr><b>בוקר טוב</b><hr>',
    p_file_name => 'but_choose_file.gif',
    p_file_mime_type => 'application/pdf',
    p_file_URL => 'http://10.172.246.160:7777/i/but_choose_file.gif');
    end;
    Second Here is the Package (please note you will have to modify few settings in order to enable it , such as mail server address ..etc)
    ======================================================================================
    CREATE OR REPLACE PACKAGE demo_mail_heb IS
    ----------------------- Customizable Section -----------------------
    -- Customize the SMTP host, port and your domain name below.
    smtp_host VARCHAR2(256) := 'mail.oracle.com';
    smtp_port PLS_INTEGER := 25;
    smtp_domain VARCHAR2(256) := 'oracle.com';
    -- Customize the signature that will appear in the email's MIME header.
    -- Useful for versioning.
    MAILER_ID CONSTANT VARCHAR2(256) := 'Mailer by Oracle UTL_SMTP';
    --------------------- End Customizable Section ---------------------
    -- A unique string that demarcates boundaries of parts in a multi-part email
    -- The string should not appear inside the body of any part of the email.
    -- Customize this if needed or generate this randomly dynamically.
    BOUNDARY CONSTANT VARCHAR2(256) := '-----7D81B75CCC90D2974F7A1CBD';
    FIRST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || utl_tcp.CRLF;
    LAST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || '--' ||
    utl_tcp.CRLF;
    -- A MIME type that denotes multi-part email (MIME) messages.
    MULTIPART_MIME_TYPE CONSTANT VARCHAR2(256) := 'multipart/mixed; boundary="'||
    BOUNDARY || '"';
    MAX_BASE64_LINE_WIDTH CONSTANT PLS_INTEGER := 76 / 4 * 3;
    -- Sent clear Html Email
    procedure send_html_mail (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default null,
    p_mime_type in varchar2 default 'text/html; charset=windows-1255');
    -- Sent Html Email with Attachment
    procedure send_html_mail_attach (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default '<b>áå÷ø èåá òåìí - áãé÷ä</b',
    p_mime_type in varchar2 default demo_mail_heb.MULTIPART_MIME_TYPE,
    p_file_name in varchar2 default 'but_choose_file.gif',
    p_file_mime_type in varchar2 default 'application/pdf',
    p_file_URL in varchar2 default 'http://10.172.246.160:7777/i/but_choose_file.gif');
    -- A simple email API for sending email in plain text in a single call.
    -- The format of an email address is one of these:
    -- someone@some-domain
    -- "Someone at some domain" <someone@some-domain>
    -- Someone at some domain <someone@some-domain>
    -- The recipients is a list of email addresses separated by
    -- either a "," or a ";"
    PROCEDURE mail(sender IN VARCHAR2,
              recipients IN VARCHAR2,
              subject IN VARCHAR2,
              message IN VARCHAR2);
    -- Extended email API to send email in HTML or plain text with no size limit.
    -- First, begin the email by begin_mail(). Then, call write_text() repeatedly
    -- to send email in ASCII piece-by-piece. Or, call write_mb_text() to send
    -- email in non-ASCII or multi-byte character set. End the email with
    -- end_mail().
    FUNCTION begin_mail(sender IN VARCHAR2,
              recipients IN VARCHAR2,
              subject IN VARCHAR2,
              mime_type IN VARCHAR2 DEFAULT 'text/plain',
              priority IN PLS_INTEGER DEFAULT NULL)
              RETURN utl_smtp.connection;
    -- Write email body in ASCII
    PROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,
              message IN VARCHAR2);
    -- Write email body in non-ASCII (including multi-byte). The email body
    -- will be sent in the database character set.
    PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,
                   message IN VARCHAR2);
    -- Write email body in binary
    PROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,
              message IN RAW);
    -- APIs to send email with attachments. Attachments are sent by sending
    -- emails in "multipart/mixed" MIME format. Specify that MIME format when
    -- beginning an email with begin_mail().
    -- Send a single text attachment.
    PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,
                   data IN VARCHAR2,
                   mime_type IN VARCHAR2 DEFAULT 'text/plain',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
              last IN BOOLEAN DEFAULT FALSE);
    -- Send a binary attachment. The attachment will be encoded in Base-64
    -- encoding format.
    PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,
                   data IN RAW,
                   mime_type IN VARCHAR2 DEFAULT 'application/octet',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
                   last IN BOOLEAN DEFAULT FALSE);
    -- Send an attachment with no size limit. First, begin the attachment
    -- with begin_attachment(). Then, call write_text repeatedly to send
    -- the attachment piece-by-piece. If the attachment is text-based but
    -- in non-ASCII or multi-byte character set, use write_mb_text() instead.
    -- To send binary attachment, the binary content should first be
    -- encoded in Base-64 encoding format using the demo package for 8i,
    -- or the native one in 9i. End the attachment with end_attachment.
    PROCEDURE begin_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                   mime_type IN VARCHAR2 DEFAULT 'text/plain',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
                   transfer_enc IN VARCHAR2 DEFAULT NULL);
    -- End the attachment.
    PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                   last IN BOOLEAN DEFAULT FALSE);
    -- End the email.
    PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection);
    -- Extended email API to send multiple emails in a session for better
    -- performance. First, begin an email session with begin_session.
    -- Then, begin each email with a session by calling begin_mail_in_session
    -- instead of begin_mail. End the email with end_mail_in_session instead
    -- of end_mail. End the email session by end_session.
    FUNCTION begin_session RETURN utl_smtp.connection;
    -- Begin an email in a session.
    PROCEDURE begin_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection,
                        sender IN VARCHAR2,
                        recipients IN VARCHAR2,
                        subject IN VARCHAR2,
    --                     mime_type IN VARCHAR2 DEFAULT 'text/plain; charset=windows-1255',
              mime_type IN VARCHAR2 DEFAULT 'text/plain',
                        priority IN PLS_INTEGER DEFAULT NULL);
    -- End an email in a session.
    PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection);
    -- End an email session.
    PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection);
    END;
    CREATE OR REPLACE PACKAGE BODY demo_mail_heb IS
    -- Sent clear Html Email
    procedure send_html_mail (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default null,
    p_mime_type in varchar2 default 'text/html; charset=windows-1255')
    Is
    conn utl_smtp.connection;
    BEGIN
    conn := demo_mail_heb.begin_mail(
    sender => p_sender,
    recipients => p_recipients,
    subject => p_subject,
    mime_type => p_mime_type);
    demo_mail_heb.write_text(
    conn => conn,
    message => p_data);
    demo_mail_heb.end_mail( conn => conn );
    END;
    -- Sent Html Email with Attachment
    procedure send_html_mail_attach (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default '<b>áå÷ø èåá òåìí - áãé÷ä</b',
    p_mime_type in varchar2 default demo_mail_heb.MULTIPART_MIME_TYPE,
    p_file_name in varchar2 default 'but_choose_file.gif',
    p_file_mime_type in varchar2 default 'application/pdf',
    p_file_URL in varchar2 default 'http://10.172.246.160:7777/i/but_choose_file.gif')
    is
    conn utl_smtp.connection;
    req utl_http.req;
    resp utl_http.resp;
    data RAW(200);
    begin
    conn := demo_mail_heb.begin_mail(
    sender => p_sender,
    recipients => p_recipients,
    subject => p_subject,
    mime_type => p_mime_type);
    demo_mail_heb.attach_text(
    conn => conn,
    data => p_data,
    mime_type => 'text/html');
    demo_mail_heb.begin_attachment(
    conn => conn,
    mime_type => p_file_mime_type,
    inline => TRUE,
    filename => p_file_name,
    transfer_enc => 'base64');
    -- In writing Base-64 encoded text following the MIME format below,
    -- the MIME format requires that a long piece of data must be splitted
    -- into multiple lines and each line of encoded data cannot exceed
    -- 80 characters, including the new-line characters. Also, when
    -- splitting the original data into pieces, the length of each chunk
    -- of data before encoding must be a multiple of 3, except for the
    -- last chunk. The constant demo_mail_heb.MAX_BASE64_LINE_WIDTH
    -- (76 / 4 * 3 = 57) is the maximum length (in bytes) of each chunk
    -- of data before encoding.
    Utl_Http.set_proxy('www-proxy.us.oracle.com', 'oracle.com');
    req := utl_http.begin_request(p_file_URL);
    resp := utl_http.get_response(req);
    BEGIN
    LOOP
    utl_http.read_raw(resp, data, demo_mail_heb.MAX_BASE64_LINE_WIDTH);
    demo_mail_heb.write_raw(
    conn => conn,
    message => utl_encode.base64_encode(data));
    END LOOP;
    EXCEPTION
    WHEN utl_http.end_of_body THEN
    utl_http.end_response(resp);
    END;
    demo_mail_heb.end_attachment( conn => conn );
    demo_mail_heb.end_mail( conn => conn );
    end;
    -- Return the next email address in the list of email addresses, separated
    -- by either a "," or a ";". The format of mailbox may be in one of these:
    -- someone@some-domain
    -- "Someone at some domain" <someone@some-domain>
    -- Someone at some domain <someone@some-domain>
    FUNCTION get_address(addr_list IN OUT VARCHAR2) RETURN VARCHAR2 IS
    addr VARCHAR2(256);
    i pls_integer;
    FUNCTION lookup_unquoted_char(str IN VARCHAR2,
                        chrs IN VARCHAR2) RETURN pls_integer AS
    c VARCHAR2(5);
    i pls_integer;
    len pls_integer;
    inside_quote BOOLEAN;
    BEGIN
    inside_quote := false;
    i := 1;
    len := length(str);
    WHILE (i <= len) LOOP
         c := substr(str, i, 1);
         IF (inside_quote) THEN
         IF (c = '"') THEN
         inside_quote := false;
         ELSIF (c = '\') THEN
         i := i + 1; -- Skip the quote character
         END IF;
         GOTO next_char;
         END IF;
         IF (c = '"') THEN
         inside_quote := true;
         GOTO next_char;
         END IF;
         IF (instr(chrs, c) >= 1) THEN
         RETURN i;
         END IF;
         <<next_char>>
         i := i + 1;
    END LOOP;
    RETURN 0;
    END;
    BEGIN
    addr_list := ltrim(addr_list);
    i := lookup_unquoted_char(addr_list, ',;');
    IF (i >= 1) THEN
    addr := substr(addr_list, 1, i - 1);
    addr_list := substr(addr_list, i + 1);
    ELSE
    addr := addr_list;
    addr_list := '';
    END IF;
    i := lookup_unquoted_char(addr, '<');
    IF (i >= 1) THEN
    addr := substr(addr, i + 1);
    i := instr(addr, '>');
    IF (i >= 1) THEN
         addr := substr(addr, 1, i - 1);
    END IF;
    END IF;
    RETURN addr;
    END;
    -- Write a MIME header
    PROCEDURE write_mime_header(conn IN OUT NOCOPY utl_smtp.connection,
                   name IN VARCHAR2,
                   value IN VARCHAR2) IS
    BEGIN
    -- utl_smtp.write_data(conn, name || ': ' || value || utl_tcp.CRLF);
    utl_smtp.write_raw_data(conn, UTL_RAW.CAST_TO_RAW(name || ': ' ||value || utl_tcp.CRLF));
    END;
    -- Mark a message-part boundary. Set <last> to TRUE for the last boundary.
    PROCEDURE write_boundary(conn IN OUT NOCOPY utl_smtp.connection,
                   last IN BOOLEAN DEFAULT FALSE) AS
    BEGIN
    IF (last) THEN
    utl_smtp.write_data(conn, LAST_BOUNDARY);
    ELSE
    utl_smtp.write_data(conn, FIRST_BOUNDARY);
    END IF;
    END;
    PROCEDURE mail(sender IN VARCHAR2,
              recipients IN VARCHAR2,
              subject IN VARCHAR2,
              message IN VARCHAR2) IS
    conn utl_smtp.connection;
    BEGIN
    conn := begin_mail(sender, recipients, subject);
    write_text(conn, message);
    end_mail(conn);
    END;
    FUNCTION begin_mail(sender IN VARCHAR2,
              recipients IN VARCHAR2,
              subject IN VARCHAR2,
              mime_type IN VARCHAR2 DEFAULT 'text/plain',
              priority IN PLS_INTEGER DEFAULT NULL)
              RETURN utl_smtp.connection IS
    conn utl_smtp.connection;
    BEGIN
    conn := begin_session;
    begin_mail_in_session(conn, sender, recipients, subject, mime_type,
    priority);
    RETURN conn;
    END;
    PROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,
              message IN VARCHAR2) IS
    BEGIN
    utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(CONVERT(message,'IW8ISO8859P8')));
    END;
    PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,
                   message IN VARCHAR2) IS
    BEGIN
    utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(message));
    END;
    PROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,
              message IN RAW) IS
    BEGIN
    utl_smtp.write_raw_data(conn, message);
    END;
    PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,
                   data IN VARCHAR2,
                   mime_type IN VARCHAR2 DEFAULT 'text/plain',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
              last IN BOOLEAN DEFAULT FALSE) IS
    BEGIN
    begin_attachment(conn, mime_type, inline, filename);
    write_text(conn, data);
    end_attachment(conn, last);
    END;
    PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,
                   data IN RAW,
                   mime_type IN VARCHAR2 DEFAULT 'application/octet',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
                   last IN BOOLEAN DEFAULT FALSE) IS
    i PLS_INTEGER;
    len PLS_INTEGER;
    BEGIN
    begin_attachment(conn, mime_type, inline, filename, 'base64');
    -- Split the Base64-encoded attachment into multiple lines
    i := 1;
    len := utl_raw.length(data);
    WHILE (i < len) LOOP
    IF (i + MAX_BASE64_LINE_WIDTH < len) THEN
         utl_smtp.write_raw_data(conn,
         utl_encode.base64_encode(utl_raw.substr(data, i,
         MAX_BASE64_LINE_WIDTH)));
    ELSE
         utl_smtp.write_raw_data(conn,
         utl_encode.base64_encode(utl_raw.substr(data, i)));
    END IF;
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    i := i + MAX_BASE64_LINE_WIDTH;
    END LOOP;
    end_attachment(conn, last);
    END;
    PROCEDURE begin_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                   mime_type IN VARCHAR2 DEFAULT 'text/plain',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
                   transfer_enc IN VARCHAR2 DEFAULT NULL) IS
    BEGIN
    write_boundary(conn);
    write_mime_header(conn, 'Content-Type', mime_type);
    IF (filename IS NOT NULL) THEN
    IF (inline) THEN
         write_mime_header(conn, 'Content-Disposition',
         'inline; filename="'||filename||'"');
    ELSE
         write_mime_header(conn, 'Content-Disposition',
         'attachment; filename="'||filename||'"');
    END IF;
    END IF;
    IF (transfer_enc IS NOT NULL) THEN
    write_mime_header(conn, 'Content-Transfer-Encoding', transfer_enc);
    END IF;
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    END;
    PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                   last IN BOOLEAN DEFAULT FALSE) IS
    BEGIN
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    IF (last) THEN
    write_boundary(conn, last);
    END IF;
    END;
    PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection) IS
    BEGIN
    end_mail_in_session(conn);
    end_session(conn);
    END;
    FUNCTION begin_session RETURN utl_smtp.connection IS
    conn utl_smtp.connection;
    BEGIN
    -- open SMTP connection
    conn := utl_smtp.open_connection(smtp_host, smtp_port);
    utl_smtp.helo(conn, smtp_domain);
    RETURN conn;
    END;
    PROCEDURE begin_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection,
                        sender IN VARCHAR2,
                        recipients IN VARCHAR2,
                        subject IN VARCHAR2,
                        mime_type IN VARCHAR2 DEFAULT 'text/plain',
                   --     mime_type IN VARCHAR2 DEFAULT 'text/plain; charset=windows-1255',
                        priority IN PLS_INTEGER DEFAULT NULL) IS
    my_recipients VARCHAR2(32767) := recipients;
    my_sender VARCHAR2(32767) := sender;
    BEGIN
    -- Specify sender's address (our server allows bogus address
    -- as long as it is a full email address ([email protected]).
    utl_smtp.mail(conn, get_address(my_sender));
    -- Specify recipient(s) of the email.
    WHILE (my_recipients IS NOT NULL) LOOP
    utl_smtp.rcpt(conn, get_address(my_recipients));
    END LOOP;
    -- Start body of email
    utl_smtp.open_data(conn);
    -- Set "From" MIME header
    write_mime_header(conn, 'From', sender);
    -- Set "To" MIME header
    write_mime_header(conn, 'To', recipients);
    -- Set "Subject" MIME header
    write_mime_header(conn, 'Subject', subject);
    -- Set "Content-Type" MIME header
    write_mime_header(conn, 'Content-Type', mime_type);
    -- Set "X-Mailer" MIME header
    write_mime_header(conn, 'X-Mailer', MAILER_ID);
    -- Set priority:
    -- High Normal Low
    -- 1 2 3 4 5
    IF (priority IS NOT NULL) THEN
    write_mime_header(conn, 'X-Priority', priority);
    END IF;
    -- Send an empty line to denotes end of MIME headers and
    -- beginning of message body.
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    IF (mime_type LIKE 'multipart/mixed%') THEN
    write_text(conn, 'This is a multi-part message in MIME format.' ||
         utl_tcp.crlf);
    END IF;
    END;
    PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection) IS
    BEGIN
    utl_smtp.close_data(conn);
    END;
    PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection) IS
    BEGIN
    utl_smtp.quit(conn);
    END;
    END;

    Hello All,
    Small modification - use this package and not the above
    HERE IS A WORKING CODE FOR SENDING HEBREW MESSAGES (INCLUDING SUBJECT IN UTF-8 APPEAR IN ALL EMAIL CLIENTS I HAVE CHECKED) + ATTACHMENTS
    Code attached below is supplied as is with no support. anyhow if help is needed , please contact me via [email protected]
    ============================================================================
    CREATE OR REPLACE PACKAGE demo_mail_heb IS
    ----------------------- Customizable Section -----------------------
    -- Customize the SMTP host, port and your domain name below.
    smtp_host VARCHAR2(256) := pst_ajax.getParameter('EMAIL_SMTP_HOST');
    smtp_port PLS_INTEGER := pst_ajax.getParameter('EMAIL_SMTP_PORT');
    smtp_domain VARCHAR2(256) := pst_ajax.getParameter('EMAIL_SMTP_DOMAIN');
    -- Customize the signature that will appear in the email's MIME header.
    -- Useful for versioning.
    MAILER_ID CONSTANT VARCHAR2(256) := 'Mailer by Oracle UTL_SMTP';
    --------------------- End Customizable Section ---------------------
    -- A unique string that demarcates boundaries of parts in a multi-part email
    -- The string should not appear inside the body of any part of the email.
    -- Customize this if needed or generate this randomly dynamically.
    BOUNDARY CONSTANT VARCHAR2(256) := '-----7D81B75CCC90D2974F7A1CBD';
    FIRST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || utl_tcp.CRLF;
    LAST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || '--' ||
    utl_tcp.CRLF;
    -- A MIME type that denotes multi-part email (MIME) messages.
    MULTIPART_MIME_TYPE CONSTANT VARCHAR2(256) := 'multipart/mixed; boundary="'||
    BOUNDARY || '"';
    MAX_BASE64_LINE_WIDTH CONSTANT PLS_INTEGER := 76 / 4 * 3;
    -- Sent clear Html Email
    procedure send_html_mail (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default null,
    p_mime_type in varchar2 default 'text/html; charset=windows-1255');
    -- Sent Html Email with Attachment
    procedure send_html_mail_attach (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default '<b>áå÷ø èåá òåìí - áãé÷ä</b',
    p_mime_type in varchar2 default 'text/html; charset=windows-1255',
    p_file_name in varchar2 default 'but_choose_file.gif',
    p_file_mime_type in varchar2 default 'application/pdf',
    p_file_URL in varchar2 default 'http://10.172.246.160:7777/i/but_choose_file.gif');
    -- A simple email API for sending email in plain text in a single call.
    -- The format of an email address is one of these:
    -- someone@some-domain
    -- "Someone at some domain" <someone@some-domain>
    -- Someone at some domain <someone@some-domain>
    -- The recipients is a list of email addresses separated by
    -- either a "," or a ";"
    PROCEDURE mail(sender IN VARCHAR2,
              recipients IN VARCHAR2,
              subject IN VARCHAR2,
              message IN VARCHAR2);
    -- Extended email API to send email in HTML or plain text with no size limit.
    -- First, begin the email by begin_mail(). Then, call write_text() repeatedly
    -- to send email in ASCII piece-by-piece. Or, call write_mb_text() to send
    -- email in non-ASCII or multi-byte character set. End the email with
    -- end_mail().
    FUNCTION begin_mail(sender IN VARCHAR2,
              recipients IN VARCHAR2,
              subject IN VARCHAR2,
              mime_type IN VARCHAR2 DEFAULT 'text/plain',
              priority IN PLS_INTEGER DEFAULT NULL)
              RETURN utl_smtp.connection;
    -- Write email body in ASCII
    PROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,
              message IN VARCHAR2);
    -- Write email body in non-ASCII (including multi-byte). The email body
    -- will be sent in the database character set.
    PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,
                   message IN VARCHAR2);
    -- Write email body in binary
    PROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,
              message IN RAW);
    -- APIs to send email with attachments. Attachments are sent by sending
    -- emails in "multipart/mixed" MIME format. Specify that MIME format when
    -- beginning an email with begin_mail().
    -- Send a single text attachment.
    PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,
                   data IN VARCHAR2,
                   mime_type IN VARCHAR2 DEFAULT 'text/plain',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
              last IN BOOLEAN DEFAULT FALSE);
    -- Send a binary attachment. The attachment will be encoded in Base-64
    -- encoding format.
    PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,
                   data IN RAW,
                   mime_type IN VARCHAR2 DEFAULT 'application/octet',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
                   last IN BOOLEAN DEFAULT FALSE);
    -- Send an attachment with no size limit. First, begin the attachment
    -- with begin_attachment(). Then, call write_text repeatedly to send
    -- the attachment piece-by-piece. If the attachment is text-based but
    -- in non-ASCII or multi-byte character set, use write_mb_text() instead.
    -- To send binary attachment, the binary content should first be
    -- encoded in Base-64 encoding format using the demo package for 8i,
    -- or the native one in 9i. End the attachment with end_attachment.
    PROCEDURE begin_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                   mime_type IN VARCHAR2 DEFAULT 'text/plain',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
                   transfer_enc IN VARCHAR2 DEFAULT NULL);
    -- End the attachment.
    PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                   last IN BOOLEAN DEFAULT FALSE);
    -- End the email.
    PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection);
    -- Extended email API to send multiple emails in a session for better
    -- performance. First, begin an email session with begin_session.
    -- Then, begin each email with a session by calling begin_mail_in_session
    -- instead of begin_mail. End the email with end_mail_in_session instead
    -- of end_mail. End the email session by end_session.
    FUNCTION begin_session RETURN utl_smtp.connection;
    -- Handling the Email Subject Line
    function mimeheader_encode(
    p_str varchar2
    , p_charset varchar2 := 'UTF-8') return varchar2;
    -- Begin an email in a session.
    PROCEDURE begin_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection,
                        sender IN VARCHAR2,
                        recipients IN VARCHAR2,
                        subject IN VARCHAR2,
    --                     mime_type IN VARCHAR2 DEFAULT 'text/plain; charset=windows-1255',
              mime_type IN VARCHAR2 DEFAULT 'text/plain',
                        priority IN PLS_INTEGER DEFAULT NULL);
    -- End an email in a session.
    PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection);
    -- End an email session.
    PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection);
    END;
    CREATE OR REPLACE PACKAGE BODY demo_mail_heb IS
    -- Sent clear Html Email
    procedure send_html_mail (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default null,
    p_mime_type in varchar2 default 'text/html; charset=windows-1255')
    Is
    conn utl_smtp.connection;
    BEGIN
    conn := demo_mail_heb.begin_mail(
    sender => p_sender,
    recipients => p_recipients,
    subject => p_subject,
    mime_type => 'text/html; charset=UTF-8');--p_mime_type);
    demo_mail_heb.write_text(
    conn => conn,
    message => p_data);
    demo_mail_heb.end_mail( conn => conn );
    END;
    -- Sent Html Email with Attachment
    procedure send_html_mail_attach (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default '<b>áå÷ø èåá òåìí - áãé÷ä</b',
    p_mime_type in varchar2 default 'text/html; charset=windows-1255',
    p_file_name in varchar2 default 'but_choose_file.gif',
    p_file_mime_type in varchar2 default 'application/pdf',
    p_file_URL in varchar2 default 'http://10.172.246.160:7777/i/but_choose_file.gif')
    is
    conn utl_smtp.connection;
    req utl_http.req;
    resp utl_http.resp;
    data RAW(200);
    v_mime_type varchar2(32767):=demo_mail.MULTIPART_MIME_TYPE;
    begin
    conn := demo_mail_heb.begin_mail(
    sender => p_sender,
    recipients => p_recipients,
    subject => p_subject,
    mime_type => v_mime_type);
    demo_mail_heb.attach_text(
    conn => conn,
    data => p_data,
    mime_type => 'text/html');
    demo_mail_heb.begin_attachment(
    conn => conn,
    mime_type => p_file_mime_type,
    inline => TRUE,
    filename => p_file_name,
    transfer_enc => 'base64');
    -- In writing Base-64 encoded text following the MIME format below,
    -- the MIME format requires that a long piece of data must be splitted
    -- into multiple lines and each line of encoded data cannot exceed
    -- 80 characters, including the new-line characters. Also, when
    -- splitting the original data into pieces, the length of each chunk
    -- of data before encoding must be a multiple of 3, except for the
    -- last chunk. The constant demo_mail_heb.MAX_BASE64_LINE_WIDTH
    -- (76 / 4 * 3 = 57) is the maximum length (in bytes) of each chunk
    -- of data before encoding.
    req := utl_http.begin_request(p_file_URL);
    resp := utl_http.get_response(req);
    BEGIN
    LOOP
    utl_http.read_raw(resp, data, demo_mail_heb.MAX_BASE64_LINE_WIDTH);
    demo_mail_heb.write_raw(
    conn => conn,
    message => utl_encode.base64_encode(data));
    END LOOP;
    EXCEPTION
    WHEN utl_http.end_of_body THEN
    utl_http.end_response(resp);
    END;
    demo_mail_heb.end_attachment( conn => conn );
    demo_mail_heb.end_mail( conn => conn );
    end;
    -- Return the next email address in the list of email addresses, separated
    -- by either a "," or a ";". The format of mailbox may be in one of these:
    -- someone@some-domain
    -- "Someone at some domain" <someone@some-domain>
    -- Someone at some domain <someone@some-domain>
    FUNCTION get_address(addr_list IN OUT VARCHAR2) RETURN VARCHAR2 IS
    addr VARCHAR2(256);
    i pls_integer;
    FUNCTION lookup_unquoted_char(str IN VARCHAR2,
    chrs IN VARCHAR2) RETURN pls_integer AS
    c VARCHAR2(5);
    i pls_integer;
    len pls_integer;
    inside_quote BOOLEAN;
    BEGIN
    inside_quote := false;
    i := 1;
    len := length(str);
    WHILE (i <= len) LOOP
    c := substr(str, i, 1);
    IF (inside_quote) THEN
    IF (c = '"') THEN
    inside_quote := false;
    ELSIF (c = '\') THEN
    i := i + 1; -- Skip the quote character
    END IF;
    GOTO next_char;
    END IF;
    IF (c = '"') THEN
    inside_quote := true;
    GOTO next_char;
    END IF;
    IF (instr(chrs, c) >= 1) THEN
    RETURN i;
    END IF;
    <<next_char>>
    i := i + 1;
    END LOOP;
    RETURN 0;
    END;
    BEGIN
    addr_list := ltrim(addr_list);
    i := lookup_unquoted_char(addr_list, ',;');
    IF (i >= 1) THEN
    addr := substr(addr_list, 1, i - 1);
    addr_list := substr(addr_list, i + 1);
    ELSE
    addr := addr_list;
    addr_list := '';
    END IF;
    i := lookup_unquoted_char(addr, '<');
    IF (i >= 1) THEN
    addr := substr(addr, i + 1);
    i := instr(addr, '>');
    IF (i >= 1) THEN
    addr := substr(addr, 1, i - 1);
    END IF;
    END IF;
    RETURN addr;
    END;
    -- Write a MIME header
    PROCEDURE write_mime_header(conn IN OUT NOCOPY utl_smtp.connection,
    name IN VARCHAR2,
    value IN VARCHAR2) IS
    BEGIN
    -- utl_smtp.write_data(conn, name || ': ' || value || utl_tcp.CRLF);
    utl_smtp.write_raw_data(conn, UTL_RAW.CAST_TO_RAW(name || ': ' ||value || utl_tcp.CRLF));
    END;
    -- Mark a message-part boundary. Set <last> to TRUE for the last boundary.
    PROCEDURE write_boundary(conn IN OUT NOCOPY utl_smtp.connection,
    last IN BOOLEAN DEFAULT FALSE) AS
    BEGIN
    IF (last) THEN
    utl_smtp.write_data(conn, LAST_BOUNDARY);
    ELSE
    utl_smtp.write_data(conn, FIRST_BOUNDARY);
    END IF;
    END;
    PROCEDURE mail(sender IN VARCHAR2,
    recipients IN VARCHAR2,
    subject IN VARCHAR2,
    message IN VARCHAR2) IS
    conn utl_smtp.connection;
    BEGIN
    conn := begin_mail(sender, recipients, subject);
    write_text(conn, message);
    end_mail(conn);
    END;
    FUNCTION begin_mail(sender IN VARCHAR2,
    recipients IN VARCHAR2,
    subject IN VARCHAR2,
    mime_type IN VARCHAR2 DEFAULT 'text/plain',
    priority IN PLS_INTEGER DEFAULT NULL)
    RETURN utl_smtp.connection IS
    conn utl_smtp.connection;
    BEGIN
    conn := begin_session;
    begin_mail_in_session(conn, sender, recipients, subject, mime_type,
    priority);
    RETURN conn;
    END;
    PROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,
    message IN VARCHAR2) IS
    BEGIN
    utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(CONVERT(message,'IW8ISO8859P8')));
    -- utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(message));
    END;
    PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,
    message IN VARCHAR2) IS
    BEGIN
    utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(message));
    END;
    PROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,
    message IN RAW) IS
    BEGIN
    utl_smtp.write_raw_data(conn, message);
    END;
    PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,
    data IN VARCHAR2,
    mime_type IN VARCHAR2 DEFAULT 'text/plain',
    inline IN BOOLEAN DEFAULT TRUE,
    filename IN VARCHAR2 DEFAULT NULL,
    last IN BOOLEAN DEFAULT FALSE) IS
    BEGIN
    begin_attachment(conn, mime_type, inline, filename);
    write_text(conn, data);
    end_attachment(conn, last);
    END;
    PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,
    data IN RAW,
    mime_type IN VARCHAR2 DEFAULT 'application/octet',
    inline IN BOOLEAN DEFAULT TRUE,
    filename IN VARCHAR2 DEFAULT NULL,
    last IN BOOLEAN DEFAULT FALSE) IS
    i PLS_INTEGER;
    len PLS_INTEGER;
    BEGIN
    begin_attachment(conn, mime_type, inline, filename, 'base64');
    -- Split the Base64-encoded attachment into multiple lines
    i := 1;
    len := utl_raw.length(data);
    WHILE (i < len) LOOP
    IF (i + MAX_BASE64_LINE_WIDTH < len) THEN
    utl_smtp.write_raw_data(conn,
    utl_encode.base64_encode(utl_raw.substr(data, i,
    MAX_BASE64_LINE_WIDTH)));
    ELSE
    utl_smtp.write_raw_data(conn,
    utl_encode.base64_encode(utl_raw.substr(data, i)));
    END IF;
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    i := i + MAX_BASE64_LINE_WIDTH;
    END LOOP;
    end_attachment(conn, last);
    END;
    PROCEDURE begin_attachment(conn IN OUT NOCOPY utl_smtp.connection,
    mime_type IN VARCHAR2 DEFAULT 'text/plain',
    inline IN BOOLEAN DEFAULT TRUE,
    filename IN VARCHAR2 DEFAULT NULL,
    transfer_enc IN VARCHAR2 DEFAULT NULL) IS
    BEGIN
    write_boundary(conn);
    write_mime_header(conn, 'Content-Type', mime_type);
    IF (filename IS NOT NULL) THEN
    IF (inline) THEN
    write_mime_header(conn, 'Content-Disposition',
    'inline; filename="'||filename||'"');
    ELSE
    write_mime_header(conn, 'Content-Disposition',
    'attachment; filename="'||filename||'"');
    END IF;
    END IF;
    IF (transfer_enc IS NOT NULL) THEN
    write_mime_header(conn, 'Content-Transfer-Encoding', transfer_enc);
    END IF;
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    END;
    PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
    last IN BOOLEAN DEFAULT FALSE) IS
    BEGIN
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    IF (last) THEN
    write_boundary(conn, last);
    END IF;
    END;
    PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection) IS
    BEGIN
    end_mail_in_session(conn);
    end_session(conn);
    END;
    FUNCTION begin_session RETURN utl_smtp.connection IS
    conn utl_smtp.connection;
    BEGIN
    -- open SMTP connection
    conn := utl_smtp.open_connection(smtp_host, smtp_port);
    utl_smtp.helo(conn, smtp_domain);
    RETURN conn;
    END;
    -- Handling the Email Subject Line
    function mimeheader_encode(
    p_str varchar2
    , p_charset varchar2 := 'UTF-8') return varchar2 is
    l_str varchar2(2000);
    begin
    l_str:=utl_raw.cast_to_varchar2(utl_encode.quoted_printable_encode(utl_raw.cast_to_raw(p_str)));
    l_str:=replace(l_str,'='||chr(13)||chr(10),''); --unfold the data
    l_str:=replace(l_str,'?','=3f'); --quote question marks
    l_str:=replace(l_str,' ','=20'); --quote spaces
    l_str:='=?'||p_charset||'?Q?'||l_str||'?='; -- add prefix and suffix
    return l_str;
    end;
    PROCEDURE begin_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection,
    sender IN VARCHAR2,
    recipients IN VARCHAR2,
    subject IN VARCHAR2,
    mime_type IN VARCHAR2 DEFAULT 'text/plain',
    -- mime_type IN VARCHAR2 DEFAULT 'text/plain; charset=windows-1255',
    priority IN PLS_INTEGER DEFAULT NULL) IS
    my_recipients VARCHAR2(32767) := recipients;
    my_sender VARCHAR2(32767) := sender;
    BEGIN
    -- Specify sender's address (our server allows bogus address
    -- as long as it is a full email address ([email protected]).
    utl_smtp.mail(conn, get_address(my_sender));
    -- Specify recipient(s) of the email.
    WHILE (my_recipients IS NOT NULL) LOOP
    utl_smtp.rcpt(conn, get_address(my_recipients));
    END LOOP;
    -- Start body of email
    utl_smtp.open_data(conn);
    -- Set "From" MIME header
    write_mime_header(conn, 'From', sender);
    -- Set "To" MIME header
    write_mime_header(conn, 'To', recipients);
    -- Set "Content-Type" MIME header
    write_mime_header(conn, 'Content-Type', mime_type);
    -- write_mime_header(conn, 'Content-Type', 'text/html; charset=UTF-8');
    -- Set "Subject" MIME header
    -- write_mime_header(conn, 'Subject', subject);
    -- write_mime_header(conn, 'Subject', CONVERT(subject,'IW8ISO8859P8'));
    write_mime_header(conn, 'Subject',mimeheader_encode(p_str => subject,p_charset => 'UTF-8'));
    -- write_mime_header(conn, 'Subject',CONVERT(subject,'IW8MSWIN1255'));
    -- Set "X-Mailer" MIME header
    write_mime_header(conn, 'X-Mailer', MAILER_ID);
    -- Set priority:
    -- High Normal Low
    -- 1 2 3 4 5
    IF (priority IS NOT NULL) THEN
    write_mime_header(conn, 'X-Priority', priority);
    END IF;
    -- Send an empty line to denotes end of MIME headers and
    -- beginning of message body.
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    IF (mime_type LIKE 'multipart/mixed%') THEN
    write_text(conn, 'This is a multi-part message in MIME format.' ||
    utl_tcp.crlf);
    END IF;
    END;
    PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection) IS
    BEGIN
    utl_smtp.close_data(conn);
    END;
    PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection) IS
    BEGIN
    utl_smtp.quit(conn);
    END;
    END;

  • XI Mail Adapter: sending emails with attachment with help of java mapping

    Hi ,
    On trying out the scenerio mentioned in the blog, using the java mapping provided
    "XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping
    The scenerio works just fine.
    But the payload as the content of the attachment is not getting generated in proper XML format.
    I suppose it's because of the replace special characters code part..
    Can anyone help me state the modification required in the code.
    Thanks!
    Regards,
    Faria Mithani

    It might be a codepage issue. Is your original payload UTF-8?

  • N8- Arabic characters show up as question marks in...

    Hi ..
    I noticed that the subject of the email is shown in the right way ( correct form of arabic characters)..
    but the body of the email which is formatted in some font and color show up as ???????????
    that replaces the arabic characters !!!
    while the exact same email show up correctly in the browser ,, but not the email ..
    ps: my phone is N8 ..
    thanks in advance..

    Dear petrib, what you are saying is 100% right, but its also Nokia issue to fix the problem with Microsoft for their customers to be satisfied... the problem is not when using Windows Live through PCs, I have the problem in my Nokia device and i am trying to contact Nokia to solve it with Microsoft... Am I right ??

Maybe you are looking for

  • Can you help me with Firefox v7.0.1?

    Since your latest version of Firefox came out, it has been working like a charm. My problems started on Oct. 23, 2011 when I found I could not delete my e-mails, close tabs or serf the web. I can use my bookmarks and get in and out of Firefox but tha

  • Full flash browser - background

    I am a very inexperienced actionscripter so any help here would be great. I am trying to load a random background in a flash clip, and resize that into the full browser dimensions. What I have working now is an "unscaled" resize... The background cli

  • Wait for success of flow in PL/SQL

    Hi! I start my flows using the PL/SQL api (createProcess, startProcess). Is there any way to wait for the execution time of the flow in the procedure? startProcess only starts a background process which executes the flow and terminates successfully a

  • Re: Windows Mail - Server Terminating Connection w...

    Just joined the forum.  I have had this problem for months now and thought it was my laptop which was getting very slow. Setting up Outlook on a desktop PC I find I have the same problem so started looking on the web for answers and found this thread

  • Bapi or RFC for Scheduled production orders?

    Hi experts, I need to extract a list of the Scheduled production orders (for a specific plant)for integration purpose. Does anyone know if there is any BAPI or RFC for this purpose and could anyone tell me which one could be used. I noted that a simi