Encoding Must be Addtion

Hi all,
This is what my Program I have written but it is showing error like
In "Text mode "  the "Encoding" addition must be specified.
My Program:
parameters filename(128) default '/usr/tmp/testfile.dat' lower case.
data msg_text(50).
open dataset filename for output in text mode message msg_text.
if sy-subrc ne 0.
write: 'File canot be opened. Reason:', msg_text.
exit.
endif.
Could you please tell me how to solve this Error.
Thanks and Regards,
Ashok.

Hi Ashok,
Award points if useful..
The addition IN TEXT MODE opens the file as a text file.
The addition ENCODING defines how the characters are represented in the text file.
When writing to a text file, the content of a data object is converted to the representation entered after ENCODING, and transferred to the file. If the data type is character-type and flat, trailing blanks are cut off. In the data type string, trailing blanks are not cut off.
In Unicode programs, only the content of character-type data objects can be transferred to text files and read from text files. The addition encoding must be specified in Unicode programs, and can only be omitted in non-Unicode programs.
Thanks,
Ravee...

Similar Messages

  • Do i have to let idvd encode assets before i burn a disk image?

    I never really noticed this before, but when I go to Project Info, it tells me that my assets are encoding. Do I have to wait for this to happen before burning a disk image, or does it encode the assets while I'm burning a disk image?
    Thanks,
    Bob

    If you have selected BEST Peformance encoding, you have an option to have your content encoded in the background as you work on the project, saving you a little time.
    In any event, all encoding must take place before iDVD can burn to a DVD disc or write a disk image file.  This happens when you tell iDVD to "Burn".

  • Text file attachment in UTF-8 encoding

    Hi
    I have written a program which sends  mails to the users with text file attached. the problem is the text file when you save it to the local desktop ( by clicking on save as ) the encoding is by default ANSI. I want to make the encoding as UTF-8. Is it possible to change this in program?.
    thanks
    sankar

    OPEN DATASET - encoding
    Syntax
    ... ENCODING { DEFAULT
                 | {UTF-8 [SKIPPING|WITH BYTE-ORDER MARK]}
                 | NON-UNICODE } ... .
    Alternatives:
    1. ... DEFAULT
    2. ... UTF-8 [SKIPPING|WITH BYTE-ORDER MARK]
    3. ... NON-UNICODE
    Effect
    : The additions after ENCODING determine the character representation in which the content of the file is handled. The addition ENCODING must be specified in Unicode programs and may only be omitted in non-Unicode programs. If the addition ENCODING is not specified in non-Unicode programs, the addition NON-UNICODE is used implicitly.
    Note
    : It is recommended that files are always written in UTF-8, if all readers can process this format. Otherwise, the code page can depend on the text environment and it is difficult to identify the code page from the file content.
    Alternative 1
    ... DEFAULT
    Effect
    : In a Unicode system, the specification DEFAULT corresponds to UTF-8, and in a non-Unicode system, it corresponds to NON-UNICODE.
    Alternative 2
    ... UTF-8 [SKIPPING|WITH BYTE-ORDER MARK]
    Addition:
    ... SKIPPING|WITH BYTE-ORDER MARK
    Effect
    : The characters in the file are handled according to the Unicode character representation UTF-8.
    Notes
    : The class CL_ABAP_FILE_UTILITIES contains the method CHECK_UTF8 for determining whether a file is a UTF-8 file.
    A UTF-16 file can only be opened as a binary file.
    Addition
    ... SKIPPING|WITH BYTE-ORDER MARK
    Effect
    : This addition defines how the byte order mark (BOM), with which a file encoded in the UTF-8 format can begin, is handled. The BOM is a sequence of 3 bytes that indicates that a file is encoded in UTF-8.
    SKIPPING BYTE-ORDER MARK
    is only permitted if the file is opened for reading or changing using FOR INPUT or FOR UPDATE. If there is a BOM at the start of the file, this is ignored and the file pointer is set after it. Without the addition, the BOM is handled as normal file content.
    WITH BYTE-ORDER MARK
    is only permitted if the file is opened for writing using FOR OUTPUT. When the file is opened, a BOM is inserted at the start of the file. Without the addition, no BOM is inserted.
    The addition BYTE-ORDER MARK cannot be used together with the AT POSITION.
    Notes
    : When opening UTF-8 files for reading, it is recommended to always enter the addition SKIPPING BYTE-ORDER MARK so that a BOM is not handled as file content.
    It is recommended to always open a file for reading as a UTF-8 with the addition WITH BYTE-ORDER MARK, if all readers can process this format.
    Alternative 3
    ... NON-UNICODE
    Effect
    : In a non-Unicode system, the data is read or written without conversion. In a Unicode system, the characters of the file are handled according to the non-Unicode codepage that would be assigned at the time of reading or writing in a non-Unicode system according to the entry in the database table TCP0C of the current text environment.

  • IDE developing JSP And Hebrew  Encoding

    Hi.
    I�m using Sun One Studio 4 CE.
    I�m new Java Programmer.
    I create JSP that use Taglib and read XML file written in Hebrew (Encoding iso-8859-1);
    When I run the file on a Tomcat I have no problems.
    But when I run the file within the ide of Sun One Studio I get gibberish.
    So. Do you know where I cane change the character settings so It work the same?
    Thanks
    Shimon

    The default encodings specified by the JSP and Servlet spec are unfortunately no good for most of the world!
    There are two issues you need to understand: page encoding, vs response encoding.
    Page encoding defines what encoding was used to create a particular page (JSP, XML, HTML). Unless the page encoding is set correctly, the entity that reads the page (e.g. the JSP parser, the web container, or the web server) cannot understand the characters before they do anything with them.
    Response encoding defines what encoding is used when the server sends the HTTP response to the browser. This is actually a separate issue from page encoding. For example, a JSP could have the page encoding set correctly (so that the JSP parser can read it), but if the response encoding is not set correctly, then what goes to the browser is still gibberish.
    To set the page encoding of a JSP, use a page directive:
    <%@page pageEncoding="UTF-8"%>
    (UTF-8 will work in Studio, there is no need to pick another more specialized charset).
    In a HTML file or XML file, use an XML directive to set the page encoding. The XML directive will not work in JSP though.
    So now the parser can translate the JSP into a servlet. But that's not good enough, because we also have to produce a response that the browser can understand.
    To set the response encoding from a servlet, you can use
    response.setContentType("text/html;UTF-8")
    In J2EE 1.4, you can also use response.setCharacterEncoding("UTF-8");
    To set it from a JSP, use
    <%@page contentType="text/html;UTF-8"%>
    All modern web browsers understand UTF-8, so that is a safe encoding to pick for the response. (It is a good encoding at the page level too if you use Studio. If you use another tool for your JSPs and it prefers a different encoding, use that at the page level but stick to UTF-8 for the response unless you have wireless clients and know that you need something else).
    Note that this can only be set before any of the response is written. So if this JSP is included into another one, and the response buffer size has been exceeded, it won't work. So the response encoding must be set as early as possible.
    What if you have a servlet that forwards to a JSP? Well, if you consider how the response object works, you should only have to set it once and earlier is better, so the servlet controller would be the obvious place. However, in J2EE 1.3, the encoding model wasn't well spec'd out, so on some servers, even if you set the response in the servlet, the JSP will overwrite it with the default if you didn't specify the content type. So experiment and set it in both the servlet and the JSP if you have to.
    From J2EE 1.4, it's OK to set the response encoding once, it the servlet - the JSP container doesn't overwrite it anymore.
    Check out the following link for more on i18n in web apps:
    http://java.sun.com/developer/technicalArticles/Intl/MultilingualJSP/

  • Can flash media live encoder feed stream to remote adobe media server installed on other machine?

    Hi All,
    i have installed  Flash Media Live Encoder 3.2 on my one machine xxx and AMS version 5 on another machine yyy.
    i am trying to configure FMLE for ams server URL - i.e. stream to flash media server option on FMLE. I have generated FMS URL as "rtmp://yyy/live" and clicked "connect" to. Its not getting connected to it.
    please find attachment for error.
    is there any restriction that our AMS should be on same machine wehere we have installed flash media live encoder ??
    please help on this!!

    If you have any trouble to understand from above query then please go through following scenarios and do reply if you have answers to it.
    I have installed Flash Media Live Encoder 3.2 on my machine and Adobe Media Server 5.0.3 on another machine.
    My requirement is to stream RTMP from Flash Media Live Encoder which is installed on my machine(source) and receive RTMP stream on Adobe Media Server which is installed on another machine.
    I am unable to connect to "rtmp://<"IP Address of Adobe Media Server installed system">/live on AMS installed machine.
    Atached please find the error message screen shot:
    Are there any restriction that Adobe Media Server and Flash Media Live Encoder must be installed on the same machine?

  • Smartform : PDF to Base64 encoding

    Hi .
    I am new to ABAP & Smartform.I have a requirement to convert smartform PDF to Base 64.I've tried the methods provided in the related SDN threads.But while decoding , junk characters are coming.Please find my code below :
    Convert SF output to PDF format
    *convert the smartform to .pdf file
          DATA : I_DOC TYPE TABLE OF DOCS,
                       WA_DOC TYPE DOCS,
                       L_PDF_STRING TYPE XSTRING.
          I_OTFDATA[] = ST_JOB_OUTPUT_INFO-OTFDATA[].
          CALL FUNCTION 'CONVERT_OTF'
            EXPORTING
              FORMAT                = 'PDF'
              MAX_LINEWIDTH         = 132
            IMPORTING
              BIN_FILESIZE          = V_BIN_FILESIZE
              BIN_FILE              = L_PDF_STRING
            TABLES
              OTF                   = I_OTFDATA
              LINES                 = I_LINES.
    Convert Table i_bin to base64 encoding
      DATA : I_BASE64  TYPE STANDARD TABLE OF SOLISTI1,
             WA_BASE64 TYPE SOLISTI1,
             WA_LINES  TYPE TLINE.
      DATA: LV_OUTPUT(255) TYPE C,
            LV_INPUT(132) TYPE C,
            LV_X(255) TYPE X,
            LV_I TYPE I.
      DATA: CONV TYPE REF TO CL_ABAP_CONV_OUT_CE.
      LOOP AT I_LINES INTO WA_LINES.
        LV_INPUT = WA_LINES-TDLINE.
        LV_I = STRLEN( LV_INPUT ).
       CONDENSE lv_input.
        IF LV_I > 0.
          TRY.
              CALL METHOD CL_ABAP_CONV_OUT_CE=>CREATE
                EXPORTING
                  ENCODING    = 'UTF-8'
                  ENDIAN      = 'L'
                  replacement = '#'
                  ignore_cerr = ABAP_FALSE
                RECEIVING
                  CONV        = CONV .
            CATCH CX_PARAMETER_INVALID_RANGE .
            CATCH CX_SY_CODEPAGE_CONVERTER_INIT .
          ENDTRY.
                  CALL METHOD CONV->WRITE
                EXPORTING
                  N      = LV_I
                  DATA   = LV_INPUT
                view   =
              IMPORTING
                len    =
              LV_X = CONV->GET_BUFFER( ).
          CALL FUNCTION 'HTTP_BASE64_ENCODE'
            EXPORTING
              INPUT        = LV_X
              INPUT_LENGTH = LV_I
            IMPORTING
              OUTPUT       = LV_OUTPUT.
        Append to Table
          WA_BASE64-LINE = LV_OUTPUT.
          APPEND WA_BASE64 TO I_BASE64.
          CLEAR : LV_OUTPUT, LV_X, LV_I, WA_BASE64, WA_LINES.
        ENDIF.
      ENDLOOP.
    Thanks,
    Jayita Ganguly

    Hi,
    Jayita2011 wrote:
    LV_X = WA_PDF-TDLINE.
    As WA_PDF-TDLINE is type C, and LV_X is type X, it does a conversion BUT it is not what you expect: LV_X = 'RMjlùIOJM%8RUZ3T', it will set LV_X = all zeroes as 'RM...' does not start with an hexadecimal string (and so base 64 would return AAAAAA). See the ABAP doc for more info.
    Moreover, base 64 encoding must be done with the whole byte stream (more precisely you must not split it outside chunks of 3 bytes, as this encoding converts 3 bytes into 4 characters, converting 2 bytes makes no sense for example, except at the end of the stream).
    I advise you to use CL_HTTP_UTILITY=>ENCODE_BASE64 which converts a string which is casted as bytes. Before, you must concatenate the lines into a string, either using CONCATENATE LINES OF lt_char INTO l_target RESPECTING BLANKS, or SWA_STRING_FROM_TABLE (keep_trailing_spaces='X') depending on your release. Don't forget to shorten the string at exactly the number of representative characters (LV_I in your example).
    BR
    Sandra

  • Lost in the new CS4 encoder. How to I encode, after working with HD 1080p30, 1440x1080, (1.3333)?

    Hi there.
    I have just upgraded from CS3 to CS4, and I see that the Encoder looks totally different, so Im getting lost in here.
    I have just created a project that is recorded with a Sony HDV HVR-Z7U, an amazing camera btw. The project is about 9 minutes long.
    The settings I have are HD 1080p30, 1440x1080, (1.3333) and 29.97 fps
    So I have this question:
    - what settings in the new CS4 encoder must I have to obtain the best quality of my video? I just get lost in them right now..
    - what settings in the new CS4 encoder must I have to encode for a use for a website, but still mainain the best quality? I guess it doesnt have to be as big as the source file?
    I would really apriciate a quick answer.

    Okey. So this is how I did it:
    My recorded footage is:
    29.97fps
    1440x1080 (1.3333)
    Audio 48000 Hz - Compressed stereo
    I encoded with:
    Format: Windows Media
    Preset: Custom (started with NTSC Source to High Quality Download)
    Filters: None
    Audiences: Compressed
    Video:
    Codec - Windows Media Video 9 Advanced
    Encoding passes - Two
    Bitrate mode - Variable unconstrained
    Frame width - 720
    Frame height - 480
    Frame rate - 29.97
    Pixel aspect ratio - HD Anamorphic 1080 (1.3333)
    Keyframe interval - 5
    Average video bitrate - 5300 kbps
    Audio:
    Encoding passes - Two
    Bitrate mode - Variable unconstrained
    Codec - Windows media audio 9.2
    Audio format - 128 kbps, 48 kHz, stereo VBR
    File size: 342 MB (video is 8.40 min long)
    The result is great, but when some scenes where camera moves fast, here is the result:
    http://img5.imageshack.us/img5/23/vid.jpg
    So, how can I get rid of those stripes? What have I done wrong with my encoding settings?
    PLEASE HELP

  • Difference between IN LEGACY TEXT MODE & TEXT MODE ENCODING NON-UNICODE

    Hi,
    We're upgrading to ECC5 and the 'open dataset' command needs amending if the program is flagged for Unicode (which usually occurrs in user/fm exits). Therefore is ECC5 this command is no longer valid:
    "open dataset DSN in text mode"
    We currently interface with systems that may not have unicode enabled. Yet we have not enabled unicode in our own system just yet.
    So we think these two commands are the most approriate for replacing the 'old' open dataset command:
    "open dataset DSN for input in TEXT MODE encoding NON-UNICODE"
    "open dataset DSN in LEGACY TEXT MODE for input"
    However we're not really sure what the difference between these two commands is?
    Has anyone worked with these commands?
    Could you offer some help as to their differences and when each should be used?
    Many thanks!

    Hi Robert,
       Here is an excerpt from sap documentation.
    ... TEXT MODE ENCODING {DEFAULT|UTF-8|NON-UNICODE}
    Effect:
    The addition IN TEXT MODE opens the file as a text file. The addition ENCODING defines how the characters are represented in the text file. When writing in a text file, the content of a data object is converted to the representation entered after ENCODING, and transferred to the file. If the data type is character-type and flat, trailing blanks are cut off. In the data type string, trailing blanks are not cut off. The end-of-line marking of the relevant platform is applied to the transferred data by default. When reading from a text file, the content of the file is read until the next end-of-line marking, converted from the format specified after ENCODING into the current character format, and transferred to a data object.
    The end-of-line marking depends on the operating system of the application server. In the MS Windows operating systems, the markings "CRLF" and " LF" are possible, while under Unix, only "LF" is used. If, when using Windows, an existing file is opened without the TYPE addition (see os_addition), the first end-of-line marking is found and used for the whole file. If a new file is created without the TYPE addition, the content of the profile parameter abap/NTfmode is used. If the profile parameter is not set, "CRLF" is used. If a file with the TYPE addition is opened and a valid value is contained in attr, this value is used.
    In Unicode programs, only the content of character-type data objects can be transferred to text files and read from text files. The addition ENCODING must be specified in Unicode programs, and can only be omitted in non-Unicode programs.
    The additions after ENCODING determine in which character representation the content of the file is handled.
    DEFAULT
    In a Unicode system, the designation DEFAULT corresponds to the designation UTF-8, and the designation NON-UNICODE in a non-Unicode system.
    UTF-8
    The characters in the file are handled according to the Unicode character representation UTF-8.
    NON-UNICODE
    In a non-Unicode system, the data is read or written without being converted. In a Unicode system,the characters in the file are handled according to the non-Unicode-codepage that would be assigned to the current text environment according to the database table TCP0C, at the time of reading or writing in a non-Unicode system.
    If the addition ENCODING is not specified in non-Unicode programs, the addition NON-UNICODE is used implicitly.
    ... LEGACY TEXT MODE [{BIG|LITTLE} ENDIAN] [CODE PAGE cp]
    Effect:
    Opening a Legacyfile. The addition IN LEGACY TEXT MODE opens the file as a legacy text file. As with legacy binary files, the byte order and the codepage with which the content of the file should be handled can also be specified. The syntax and meaning of {BIG|LITTLE} ENDIAN and CODE PAGE cp are the same as for legacy binary files.
    In contrast to legacy binary files, the trailing blanks in a legacy file are cut off when writing character-type flat data objects in a legacy text file. As for a text file, an end-of-line marking is also applied to the transferred data. In contrast to text files opened with the addition INTEXT MODE, Unicode programs do not check whether the data objects used for reading or writing are character-type. Furthermore, the LENGTH additions of the statements READ DATASET and TRANSFER are used for counting in bytes in legacy text files and in the units of a character represented in the memory for text files.
    Note:
    As with legacy binary files, text files that have been written in a non-Unicode system can be accessed in Unicode systems as legacy text files, and the content is converted accordingly.
    Example
    A file test.dat is created as a text file, filled with data, changed, and exported. As every TRANSFER statement applies end-of-line marking to written content, after the change, the content of the file has two lines. The first line contains "12ABCD". The second line contains "890". The character "7" has been overwritten by the end-of-line marking of the first line.
    DATA: file   TYPE string VALUE `test.dat`,
          result TYPE string.
    OPEN DATASET file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    TRANSFER `1234567890` TO file.
    CLOSE DATASET file.
    OPEN DATASET file FOR UPDATE IN TEXT MODE ENCODING DEFAULT
                                 AT POSITION 2.
    TRANSFER `ABCD` TO file.
    CLOSE DATASET file.
    OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    WHILE sy-subrc = 0.
      READ DATASET file INTO result.
      WRITE / result.
    ENDWHILE.
    CLOSE DATASET file.
    Regards,
    Ravi

  • Encoding questions

    Hello,
    I have some encoding questions, my projects are PAL-AVCHD-Full HD 1080i 25 5.1 channel. I export the videos in Windows Media, here come the questions.
    What’s the difference between one and two encoding passes?
    What does “Allow interlaced processing” do?
    Thanks,
    Enrique

    Enrique,
    Let's look at the 1-pass vs 2-pass Encoding.
    When one sets the general parameters for Encoding and chooses 1-pass, the parameters are applied over the entire Timeline. This is the quickest method for Encoding and will be pretty good, based on the chosen parameters.
    With 2-pass, the Encoding program will first look at the footage, in the scheme of the chosen parameters, but while doing so, will look for faster motion (both camera and subject) in the Timeline. Where it finds the motion, it will mark it for the highest setting in the parameters. The highest settings will be applied to the sections with the most motion, and the "average" will be applied to the rest. This yields a better Encoded file, especially where there is motion. This Encoding method takes longer, as the Encoder must look at all of the footage first to decide what to do, and then to apply the Encoding parameters.
    The Encoders used by Hollywood, are usually at least 9-pass, and often quite a bit more. They are also run by experts, who do nothing but Encode all day, and are highly-paid for their work and their expertise. This is why the high motion footage in a commercial DVD will look smoother, than what we can accomplish, and the file will likely even be smaller. Those Encoding programs cost hundreds of thousands of $, so it's not like we could download one and use it, even if we were experts and could figure out the settings.
    So to wrap up, a good Encoding engine will likely do a fair job when set to 1-pass, but especially with higher motion footage, likely a better job with 2-pass, and the only cost is time. Unless I am trying to Encode a quick reference file, I will always use multi-pass schemes, to get the best possible output, and just have a cup, or two, of coffee, while I wait. Also, there are better Encoders, than the ones included in our NLE's and authoring programs. Grass Valley's ProCoder is one that gets really high marks - this side of Hollywood.
    Good luck,
    Hunt

  • Problems concerning sonata playlists and freevo cover art

    Hi!
    I'm setting up a media center PC and I'm having some problems with the playlists created by sonata. Another problem I have is not getting freevo to download cover art.
    First: When ever I try to make a playlist through the "Current" tab in Sonata it creates a m3u file with every song that's listed in the current window. I'm used to being able to pick one or a couple of songs and then adding it a specified playlist. Is this impossible in sonata? And if I try to play the m3u file created (the one with every song listed) through freevo I get a message that the directory is empty. What am I doing wrong??
    Second: I'm having big problems getting freevo to download cover art to my music. I can download info on movies from imdb, but info for the music doesn't work. I store the cover art downloaded by sonata in the different album folders and these covers show up in freevo. But if I have to play every new song i download first in sonata to get the cover art working in freevo I'll go crazy. It's supposed to work the same way in freevo as in sonata isn't it???
    It also seems that mplayer can't play m3u files. Using the mentioned sonata made m3u file in mplayer does nothing. Mplayer starts but nothing happens.
    My goal is to be able to make playlists through sonata and then play these lists using freevo. I don't want to get up from the couch. 
    Here's my local_conf.py:
    # -*- coding: iso-8859-1 -*-
    # local_conf.py - System configuration
    # $Id: local_conf.py.example 10508 2008-03-12 07:24:34Z duncan $
    # Notes:
    # This file contains your freevo settings, overriding the settings in
    # freevo_config.py. freevo_config.py, which is usually installed in
    # /usr/share/freevo, contains all the core settings. To change the settings copy
    # this file to ~/.freevo/local_conf.py or /etc/freevo/local_conf.py
    # It does not contain all the possible settings that you can change, see
    # freevo_config.py for all the possible settings. Also it does not contain
    # settings for the plug-ins, plug-ins contain their configuration information and
    # the can be listed with:
    # | freevo plugins -l
    # and the settings can se shown with
    # | freevo plugins -i <name of plug-in>
    # E.g.: when you want a alsa as mplayer audio out, just put in local_conf.py:
    # | MPLAYER_AO_DEV = 'alsa9'
    # The vertical line indicates code.
    # This is no normal config file, it's Python code. Because of that, you
    # need to follow some rules to avoid crashes. The examples should explain
    # the settings, but make sure a line starting with a variable has NO SPACES OR
    # TABS at the beginning.
    # Freevo - A Home Theater PC framework
    # Copyright (C) 2002 Krister Lagerstrom, et al.
    # Please see the file freevo/Docs/CREDITS for a complete list of authors.
    # This program is free software; you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation; either version 2 of the License, or
    # (at your option) any later version.
    # This program is distributed in the hope that it will be useful, but
    # WITHOUT ANY WARRANTY; without even the implied warranty of MER-
    # CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
    # Public License for more details.
    # You should have received a copy of the GNU General Public License along
    # with this program; if not, write to the Free Software Foundation, Inc.,
    # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    CONFIG_VERSION = 5.23
    # ======================================================================
    # General freevo settings:
    # ======================================================================
    # LOCALE='iso-8859-15'
    # AUDIO_DEVICE = '/dev/dsp' # e.g.: /dev/dsp0, /dev/audio, /dev/alsa/?
    # AUDIO_INPUT_DEVICE = '/dev/dsp1' # e.g.: /dev/dsp0, /dev/audio, /dev/alsa/?
    # MIXER_MAJOR_CTRL = 'VOL' # Freevo takes control over one audio ctrl
    # 'VOL', 'PCM' 'OGAIN' etc.
    # MIXER_MAJOR_MUTE_CTRL = 'PCM' # used in alsamixer.py There are systems where
    # volume and mute use different controls
    # MIXER_DEVICE = '/dev/mixer' # mixer device
    # MIXER_CONTROL_ALL = 1 # Should Freevo take complete control of audio
    # MIXER_VOLUME_MAX = 90 # Set what you want maximum volume level to be.
    # MIXER_VOLUME_DEFAULT = 40 # Set default volume level.
    # MIXER_VOLUME_TV_IN = 60 # Set this to your preferred level 0-100.
    # MIXER_VOLUME_VCR_IN = 90 # If you use different input from TV
    # MIXER_VOLUME_RADIO_IN = 80 # Set this to your preferred level 0-100.
    START_FULLSCREEN_X = 1 # Start in fullscreen mode if using x11 or xv.
    # SYS_SHUTDOWN_CONFIRM = 1 # ask before shutdown
    # Physical ROM drives, multiple ones can be specified
    # by adding comma-seperated and quoted entries.
    # Format [ ('mountdir1', 'devicename1', 'displayed name1'),
    # ('mountdir2', 'devicename2', 'displayed name2'), ...]
    # Set to None to autodetect drives in during startup from /etc/fstab,
    # set to [] to disable rom drive support at all
    # ROM_DRIVES = None
    # Hide discs from the wrong menu (e.g. VCDs in audio menu) and empty discs.
    HIDE_UNUSABLE_DISCS = 1
    # Attempt to set the speed of the ROM drive. A good value for keeping the
    # drive silent while playing movies is 8.
    # ROM_SPEED = 0
    # Perform a whole system shutdown at SHUTDOWN! Useful for standalone boxes.
    # SYS_SHUTDOWN_ENABLE = 0
    # Command to execute to shutdown the system
    # SYS_SHUTDOWN_CMD = "sudo shutdown -h now"
    # SYS_RESTART_CMD = "sudo shutdown -r now"
    # ======================================================================
    # AUTOSHUTDOWN CONFIGURATION
    # ======================================================================
    # replace the default shutdown plugin
    # plugin.remove('shutdown')
    # plugin.activate('autoshutdown', level=90)
    # activate the timer
    # plugin.activate('autoshutdown.autoshutdowntimer')
    # -- autoshutdown menu item configuration --
    # SYS_SHUTDOWN_CONFIRM
    # Set to True to popup dialog boxes for confirmation.
    # this applies to menu items only.
    # AUTOSHUTDOWN_CONFIRM = True
    # -- autoshutdown timer configuration --
    # TIMER_TIMEOUT
    # Set the timeout in minutes after which the system
    # is shutdown. The allowed idle time and the running
    # processes (see below) are evaluated to determine if
    # a shutdown is allowed. Menu navigation in freevo will
    # reset the timer.
    # AUTOSHUTDOWN_TIMER_TIMEOUT=30
    # -- autoshutdown behaviour configuration --
    # PRETEND
    # Set to True to disable the actual shutdown command.
    # AUTOSHUTDOWN_PRETEND = False
    # PROCESS_LIST
    # List the processes that will prevent an automatic
    # shutdown. If there are important programs that
    # should not be interrupted, then add them to this
    # list. Set to None if a shutdown is always allowed.
    # AUTOSHUTDOWN_PROCESS_LIST = [
    # 'emerge',
    # 'tvgids',
    # 'transcode',
    # 'cdrecord',
    # 'mplayer',
    # 'top'
    # DEFAULT_WAKEUP_TIME
    # Set the default time at which to wakeup if there
    # are no recordings scheduled. The time is specified
    # in localtime 24 hour format. Set to None to disable
    # default wakeup time.
    # AUTOSHUTDOWN_DEFAULT_WAKEUP_TIME = "13:00"
    # FORCE_DEFAULT_WAKEUP
    # Set to True to always wakeup at the default wakeup
    # time. Set to False to only wakeup at the default
    # wakeup time when no recordings are scheduled.
    # AUTOSHUTDOWN_FORCE_DEFAULT_WAKEUP = True
    # ALLOWED_IDLE_TIME
    # The number of minutes that may be spent idle until
    # the next scheduled recording or default wakeup. That
    # is, if the gap between "now" and the next recording
    # or default wakeup is less than the allowed idle time
    # then a shutdown is not performed but the system is
    # left running. If the period from now to the next
    # recording or default wakeup is more than the allowed
    # idle time, then the system is shut down and a wakeup
    # is scheduled. Use this to minimize the number of
    # shutdown/boot sequences when many short programs are
    # recorded in a short period of time. Note that this
    # variable is used by both the timer and the menu.
    # AUTOSHUTDOWN_ALLOWED_IDLE_TIME = 45
    # -- Choice of wakeup method
    # The wakeup can be done via acpi-alarm or nvram-wakeup.
    # AUTOSHUTDOWN_METHOD = 'acpi'
    # AUTOSHUTDOWN_METHOD = 'nvram'
    # -- autoshutdown acpi-alarm configuration
    # This method uses the wakeup on alarm function that most BIOSs have.
    # The wakeup time is set by a simple
    # "echo 2004-08-02 20:15:00 >/proc/acpi/alarm"
    # On most mainbords you will have to ENABLE "Wake on Timer", "Resume on Alarm",
    # "RTC Alarm Resume" or similar things for the acpi wakeup method to work.
    # If you want to use acpi, you need to create a small script:
    # !/bin/sh
    # echo "$1" >/proc/acpi/alarm
    # You have to be root or use sudo for this to work.
    # AUTOSHUTDOWN_WAKEUP_CMD = sudo /PATH/TO/set_acpi.sh
    # -- autoshutdown nvram-wakeup configuration --
    # The nvram-wakeup utility is used to write the
    # wakeup alarm to the RTC in bios. Read the
    # nvram-wakeup documentation about this topic,
    # a working nvram-wakeup configuration is needed.
    # WAKEUP_CMD / NVRAM_OPT
    # Path to nvram-wakeup and options. Options can
    # be used to specify a config file.
    # AUTOSHUTDOWN_WAKEUP_CMD = "/usr/bin/nvram-wakeup"
    # AUTOSHUTDOWN_NVRAM_OPT = "--syslog"
    # WAKEUP_NEEDS_REBOOT
    # Set to True if the bios needs a reboot to catch
    # up with the rtc alarm that nvram-wakeup sets. The
    # boot loader options should be set too. Read the
    # nvram-wakeup documentation about this topic.
    # AUTOSHUTDOWN_BIOS_NEEDS_REBOOT = True
    # -- if the bios needs a reboot --
    # BOOT_LOADER
    # Set to "GRUB" or "LILO" Only needed if bios needs
    # a reboot to initialize the RTC wakeup call.
    # AUTOSHUTDOWN_BOOT_LOADER = "GRUB"
    # REMOUNT_BOOT_CMD / REMOUNT_BOOT_OPT
    # Grub needs to write to /boot/grub/grub.conf. Set
    # the command and options to remount the /boot
    # partition writeable. Set to None if this is not
    # needed.
    # AUTOSHUTDOWN_REMOUNT_BOOT_CMD = "/bin/mount"
    # AUTOSHUTDOWN_REMOUNT_BOOT_OPT = "/boot -o remount,rw"
    # GRUB_CMD / GRUB_OPT
    # Grub-set-default command and options that will
    # reboot and poweroff the system.
    # AUTOSHUTDOWN_GRUB_CMD = "/sbin/grub-set-default 0"
    # AUTOSHUTDOWN_GRUB_OPT = "0"
    # LILO_CMD / LILO_OPT
    # Lilo command with options that will reboot and
    # poweroff the system.
    # AUTOSHUTDOWN_LILO_CMD = "/sbin/lilo"
    # AUTOSHUTDOWN_LILO_OPT = "-R PowerOff"
    # ======================================================================
    # Events
    # ======================================================================
    # You can add more keybindings by adding them to the correct hash.
    # e.g. If you want to send 'contrast -100' to mplayer by pressing the '1' key,
    # just add the following line:
    # EVENTS['video']['1'] = Event(VIDEO_SEND_MPLAYER_CMD, arg='contrast -100')
    # See src/event.py for a list of all possible events.
    # Some events to jump to menus
    # EVENTS['menu']['GUIDE'] = Event(MENU_GOTO_TVGUIDE) # Not working
    # EVENTS['menu']['VIDEOS'] = Event(MENU_GOTO_VIDEOS)
    # EVENTS['menu']['MUSIC'] = Event(MENU_GOTO_MUSIC)
    # EVENTS['menu']['PICTURES'] = Event(MENU_GOTO_IMAGES)
    # EVENTS['menu']['GAMES'] = Event(MENU_GOTO_GAMES)
    # EVENTS['menu']['RADIO'] = Event(MENU_GOTO_RADIO) # Not working
    # EVENTS['menu']['POWER'] = Event(MENU_GOTO_SHUTDOWN)
    # Use arrow keys for back and select (alternate way of navigating)
    # MENU_ARROW_NAVIGATION = False
    # Process keyboard events from SDL. You want this unless you use only lirc
    # or event devices below.
    # USE_SDL_KEYBOARD = True
    # Keymap to map keyboard keys to event strings. You can also add new keys
    # here, e.g. KEYMAP[key.K_x] = 'SUBTITLE'. The K_-names are defined by pygame.
    # List of /dev/input/event# devices to monitor. You can specify either the
    # device node (e.g. '/dev/input/event1') or the name of the device (e.g.
    # 'ATI Remote Wonder II'). If you monitor your keyboard both here and with
    # USE_SDL_KEYBOARD, then you will get duplicate events.
    EVENT_DEVS = []
    # Keymap to map input events to event strings. You can change current mappings
    # and add new ones here, e.g. EVENTMAP['KEY_COFFEE'] = 'SUBTITLE'. Key names
    # are defined by the Linux input layer (input.h). An axis is described by a
    # pair, one for positive and one for negative movement, e.g.
    # EVENTMAP['REL_Z'] = ('LEFT', 'RIGHT')
    # Use Internet resources to fetch information?
    # For example, Freevo can use CDDB for album information,
    # the IMDB movie database for movie info, and Amazon for cover searches.
    # Set this to 0 if your computer isn't connected to a network.
    USE_NETWORK = 1
    # Directory location to save files when the normal filesystem
    # doesn't allow saving. This directory can save covers and fxd files
    # for read only filesystems like ROM drives. Set this variable to your
    # old MOVIE_DATA_DIR if you have one. It needs to be set to a directory
    # Freevo can write to.
    # OVERLAY_DIR = os.path.join(FREEVO_CACHEDIR, 'vfs')
    # Umask setting for all files.
    # 022 means only the user has write access. If you share your Freevo
    # installation with different users, set this to 002
    # UMASK = 022
    # Suffix for playlist files
    PLAYLIST_SUFFIX = [ 'm3u' ]
    # Use md5 in mmpython to create unique disc ids. Enable this if you have
    # problems with different discs having the same id.
    # MMPYTHON_CREATE_MD5_ID = 0
    # Keep metadata in memory
    # Setting this variable will keep all cache files in memory. Startup will be
    # slower, but for large directories, this will speed up the display.
    # 0 = Only keep current dir in memory. Use this if you have too much data
    # and not enough RAM
    # 1 = Once loaded, keep cachefile for directory in memory
    # 2 = Load all cachefiles on startup
    # WARNING: you should not run 'freevo cache' when freevo is running.
    # MEDIAINFO_USE_MEMORY = 1
    # Cache images. This uses a lot of disc space but it's a huge speed
    # enhancement. The images will be cached in OVERLAY_DIR
    CACHE_IMAGES = 1
    # ======================================================================
    # Plugins:
    # ======================================================================
    # Remove undesired plugins by setting plugin.remove(code).
    # You can also use the name to remove a plugin. But if you do that,
    # all instances of this plugin will be removed.
    # Examples:
    # plugin.remove(plugin_tv) or
    # plugin.remove('tv') will remove the tv module from the main menu
    # plugin.remove(rom_plugins['image']) will remove the rom drives from the
    # image main menu,
    # plugin.remove('rom_drives.rom_items') will remove the rom drives from all
    # menus
    # See freevo_config.py for a list of loaded plugins
    plugin.remove('tv')
    plugin.remove('headlines')
    plugin.remove('idlebar.tv')
    plugin.remove('idlebar.diskfree')
    plugin.remove('file_ops')
    plugin.remove('tv.generic_record')
    plugin.remove('tv.view_recordings')
    plugin.remove('tv.mplayer')
    plugin.remove('tv.manual_record')
    plugin.remove('tv.scheduled_recordings')
    plugin.remove('tv.view_favorites')
    plugin.remove('video.moviecovers')
    # User setup
    plugin.activate('audio.coversearch')
    # plugin.activate('video.moviecovers')
    plugin.activate('video.details')
    # list of regexp to be ignored on a disc label
    IMDB_REMOVE_FROM_LABEL = ('season[\._ -][0-9]+', 'disc[\._ -][0-9]+',
    'd[\._ -][0-9]+', 'german')
    # list of words to ignore when searching based on a filename
    IMDB_REMOVE_FROM_SEARCHSTRING = ('the', 'a')
    # When searching for a movie title in imdb, should the result be
    # autoaccepted if it is only one hit?
    # 0 = show menu even if it is only one hit (gives you an opportunity to cancel)
    # 1 = autoaccept
    IMDB_AUTOACCEPT_SINGLE_HIT = 1
    SCREENSAVER_DELAY = 30 # of seconds to wait to start saver.
    SCREENSAVER_CYCLE_TIME = 60 # of seconds to run a screensaver before starting another saver.
    plugin.activate('screensaver')
    # Use ivtv_record instead if you have an ivtv based card (PVR-250/350)
    # and want freevo to do everthing for you. TV_SETTINGS must be set
    # correctly. To use you need to set the following two lines:
    # plugin.remove('tv.generic_record')
    # plugin_record = plugin.activate('tv.ivtv_record')
    # Enable this for joystick support:
    # plugin.activate('joy')
    # Headlines
    # You are free to use any rss feeds in the HEADLINES_LOCATIONS below
    # These are just working examples for the Freevo feeds.
    # To turn off Headlines add plugin.remove('headlines')
    # plugin.activate('headlines', level=45)
    # HEADLINES_LOCATIONS = [
    # ('Freevo news releases', 'http://sourceforge.net/export/rss2_projnews.php?group_id=46652'),
    # ('Freevo file releases', 'http://sourceforge.net/export/rss2_projfiles.php?group_id=46652'),
    # ('Freevo summary+stats', 'http://sourceforge.net/export/rss2_projsummary.php?group_id=46652'),
    # ('Freevo donors', 'http://sourceforge.net/export/rss2_projdonors.php?group_id=46652'),
    # CD Ripping
    # CD_RIP_TMP_DIR = '/tmp/'
    # CD_RIP_TMP_NAME = 'track_%(track)s_being_ripped'
    # CD_RIP_PN_PREF = '%(artist)s/%(album)s/%(track)s - %(song)s'
    # CD_RIP_CDPAR_OPTS = '-s'
    # CD_RIP_LAME_OPTS = '--vbr-new -b 192 -h'
    # CD_RIP_OGG_OPTS = '-m 128'
    # CD_RIP_FLAC_OPTS = '-8'
    # CD_RIP_CASE = None # Can be title, upper, lower
    # CD_RIP_REPLACE_SPACE = None # Can be '_', '-', etc.
    # CD Burning
    # CDBURN_AUDIO_DAO = 1
    # CDBURN_MKISOFS_PATH = '/usr/bin/mkisofs'
    # CDBURN_CDRECORD_PATH = '/usr/bin/cdrecord'
    # CDBURN_TEMP_DIR='/tmp/'
    # CDBURN_DEV = '/dev/cdrom'
    # CDBURN_SPEED = 32
    # Re-encode
    # This plug-in transcodes a video to a different format
    # plugin.activate('video.reencode')
    # REENCODE_CONTAINER = 'avi'
    # REENCODE_RESOLUTION = 'Optimal'
    # REENCODE_VIDEOCODEC = 'XviD'
    # REENCODE_VIDEOBITRATE = 1000
    # REENCODE_AUDIOCODEC = 'MPEG 1 Layer 3 (mp3)'
    # REENCODE_AUDIOBITRATE = 128
    # REENCODE_NUMPASSES = 1
    # REENCODE_VIDEOFILTER = None
    # Freevo Music Player Daemon
    # http://www.musicpd.org/
    # plugin.activate('mpd')
    # Freevo Bluetooth Phone Settings
    # This plugin uses The Python bindings for Bluez bluetooth stack.
    # It can be downloaded from http://org.csail.mit.edu/pybluez/download.html
    # or installed with the package manager of your operating system.
    # To this plugin to work you need the j2me midlet installed in a compatible
    # phone.
    # plugin.activate('freevused')
    # if RFCOMM port is already binded wait this seconds to retry binding
    # FVUSED_BIND_TIMEOUT = 30
    # Translation of commands from j2me client to events of Freevo
    # FVUSED_CMDS = {
    # 'PREV': 'UP', # 1st row left
    # 'STRT': 'SELECT', # 1nd row center
    # 'NEXT': 'DOWN', # 1st row right
    # 'RWND': 'LEFT', # 2nd row left
    # 'PAUS': 'PAUSE', # 2nd row center
    # 'FFWD': 'RIGHT', # 2nd row right
    # 'VOL-': 'MIXER_VOLDOWN', # 3rd row left
    # 'STOP': 'EXIT', # 3rd row center
    # 'VOL+': 'MIXER_VOLUP', # 3rd row right
    # 'VOLM': 'MIXER_VOLMUTE', # 4th row left
    # 'SLCT': 'ENTER', # 4th row center
    # 'MAIN': 'MENU' # 4th row right
    # Freevo Button Bar Plug-in
    # plugin.activate('buttonbar')
    # You'll also need to map the 'RED', 'GREEN', 'YELLOW'
    # and 'BLUE' events to keys for example (don't use this
    # it overrides some default keys)
    # KEYMAP[key.K_F5] = 'RED'
    # KEYMAP[key.K_F6] = 'GREEN' #Already mapped to record
    # KEYMAP[key.K_F7] = 'YELLOW'
    # KEYMAP[key.K_F8] = 'BLUE'
    # Freevo Screensaver Plug-in
    # SCREENSAVER_DELAY = 120 # of seconds to wait to start saver.
    # SCREENSAVER_CYCLE_TIME = 60 # of seconds to run a screensaver before starting another saver.
    # plugin.activate('screensaver')
    # plugin.activate('screensaver.balls') # Bouncing balls all over the screen
    # plugin.activate('screensaver.bouncing_freevo') # The freevo logo bouncing around the screen
    # ======================================================================
    # Freevo directory settings:
    # ======================================================================
    # You can change all this variables in the folder.fxd on a per folder
    # basis
    # Example:
    # <freevo>
    # <folder title="Title of the directory" img-cover="nice-cover.png">
    # <setvar name="directory_autoplay_single_item" val="0"/>
    # <info>
    # <content>A small description of the directory</content>
    # </info>
    # </folder>
    # </freevo>
    # Should directories sorted by date instead of filename?
    # 0 = No, always sort by filename.
    # 1 = Yes, sort by date
    # 2 = No, don't sory by date for normal directories,
    # but sort by date for TV_RECORD_DIR.
    DIRECTORY_SORT_BY_DATE = 0
    # Should directory items be sorted in reverse order?
    # DIRECTORY_REVERSE_SORT = 0
    # Should we use "smart" sorting?
    # Smart sorting ignores the word "The" in item names.
    DIRECTORY_SMART_SORT = 1
    # Should files in directories have smart names?
    # This removes the first part of the names when identical
    # DIRECTORY_SMART_NAMES = 1
    # Should Freevo autoplay an item if only one item is in the directory?
    DIRECTORY_AUTOPLAY_SINGLE_ITEM = 0
    # Force the skin to use a specific layout number. -1 == no force. The layout
    # toggle with DISPLAY will be disabled
    # DIRECTORY_FORCE_SKIN_LAYOUT = -1
    # Format string for the audio item names.
    # Possible strings:
    # a=artist, n=tracknumber, t=title, y=year, f=filename
    # Example:
    # This will show the title and the track number:
    # DIRECTORY_AUDIO_FORMAT_STRING = '%(n)s - %(t)s'
    # DIRECTORY_AUDIO_FORMAT_STRING = '%(t)s'
    # Use media id tags to generate the name of the item. This should be
    # enabled all the time. It should only be disabled for directories with
    # broken tags.
    DIRECTORY_USE_MEDIAID_TAG_NAMES = 1
    # The following settings determine which features are available for
    # which media types.
    # If you set this variable in a folder.fxd, the value is 1 (enabled)
    # or 0 (disabled).
    # Examples:
    # To enable autoplay for audio and image files:
    # DIRECTORY_AUTOPLAY_ITEMS = [ 'audio', 'image' ]
    # To disable autoplay entirely:
    # DIRECTORY_AUTOPLAY_ITEMS = []
    # Make all items a playlist. So when one is finished, the next one will
    # start. It's also possible to browse through the list with UP and DOWN
    # DIRECTORY_CREATE_PLAYLIST = [ 'audio', 'image' ]
    # Add playlist files ('m3u') to the directory
    # DIRECTORY_ADD_PLAYLIST_FILES = [ 'audio', 'image' ]
    # Add the item 'Random Playlist' to the directory
    # DIRECTORY_ADD_RANDOM_PLAYLIST = [ 'audio' ]
    # Make 'Play' not 'Browse' the default action when only items and not
    # subdirectories are in the directory
    # DIRECTORY_AUTOPLAY_ITEMS = [ ]
    # ======================================================================
    # Freevo movie settings:
    # ======================================================================
    # Where the movie files can be found.
    # This is a list of items (e.g. directories, fxd files). The items themselves
    # can also be a list of (title, file)
    VIDEO_ITEMS = [
    ('movies', '/home/per/movies'),
    ('movies extra', '/extra/movies'),
    ('tv', '/home/per/tv'),
    ('tv extra', '/extra/tv'),
    # Some people access movies on a different machine using an automounter.
    # To avoid timeouts, you can specify the machine name in the directory
    # to check if the machine is alive first
    # Directory myserver:/files/server-stuff will show the item for the
    # directory /files/server-stuff if the computer myserver is alive.
    # The list of filename suffixes that are used to match the files that
    # are played wih MPlayer.
    # VIDEO_MPLAYER_SUFFIX = [ 'avi', 'mpg', 'mpeg', 'wmv', 'bin', 'rm',
    # 'divx', 'ogm', 'vob', 'asf', 'm2v', 'm2p',
    # 'mp4', 'viv', 'nuv', 'mov', 'iso',
    # 'nsv', 'mkv' ]
    # The list of filename suffixes that are used to match the files that
    # are played wih Xine.
    # VIDEO_XINE_SUFFIX = [ 'avi', 'mpg', 'mpeg', 'rm', 'divx', 'ogm',
    # 'asf', 'm2v', 'm2p', 'mp4', 'mov', 'cue' ]
    # Preferred video player
    VIDEO_PREFERED_PLAYER = 'mplayer'
    # Only scan OVERLAY_DIR and VIDEO_SHOW_DATA_DIR for fxd files containing
    # information about a disc. If you only have the fxd files for discs in
    # one of this directories (and subdirectories), set this to 1, it will
    # speed up startup, 0 may be needed if you have fxd files with disc links
    # in your normal movie tree.
    # VIDEO_ONLY_SCAN_DATADIR = 1
    # try to detect a movie with more than one file and join them as one
    # item
    VIDEO_AUTOJOIN = 1
    # try to find out if deinterlacing is needed or not
    # VIDEO_DEINTERLACE = None
    # Instruct player to use XVMC for playback
    # VIDEO_USE_XVMC = None
    # Pass field dominance parameter to MPlayer
    # VIDEO_FIELD_DOMINANCE = None
    # PRE and POST playing commands. Set these to a runnable command if
    # you wish to do something before and after playing a video, like
    # dimming the lights
    # VIDEO_PRE_PLAY = None
    # VIDEO_POST_PLAY = None
    # ======================================================================
    # Freevo audio settings:
    # ======================================================================
    # Where the Audio (mp3, ogg) files can be found.
    # This is a list of items (e.g. directories, fxd files). The items themselves
    # can also be a list of (title, file)
    # To add webradio support, add fxd/webradio.fxd to this list
    AUDIO_ITEMS = [
    ('music', '/home/per/music'),
    ('music extra', '/extra/music'),
    ('playlists', '/home/per/.mpd/playlists'),
    # The list of filename suffixes that are used to match the files that
    # are played as audio.
    # AUDIO_SUFFIX = [ 'mp3', 'ogg', 'wav','m4a', 'wma', 'aac', 'flac', 'mka' ]
    # Regular expression used to recognize filenames which are likely to be
    # covers for an album
    # This will match front.jpg and cover-f.jpg, but not back.jpg nor cover-b.jpg:
    # AUDIO_COVER_REGEXP = 'front|-f'
    # Format strings used to seach for audio cover images.
    # Fist matching GIF, JPG or PNG image will be used as cover.
    # Examples:
    # AUDIO_COVER_FORMAT_STRINGS = [ 'cover-%(artist)s-%(album)s', 'mycover' ]
    # AUDIO_COVER_FORMAT_STRINGS = [ '%(album)s', '../covers/%(album)s', '../covers/nocover' ]
    # Preferred audio player
    AUDIO_PREFERED_PLAYER = 'mplayer'
    # Show video files in the audio menu (for music-videos)
    AUDIO_SHOW_VIDEOFILES = False
    # ======================================================================
    # Freevo image viewer settings:
    # ======================================================================
    # Where image files can be found.
    # This is a list of items (e.g. directories, fxd files). The items itself
    # can also be a list of (title, file)
    IMAGE_ITEMS = [
    ('pictures', '/home/per/pictures'),
    # The list of filename suffixes that are used to match the files that
    # are used for the image viewer.
    # IMAGE_SUFFIX = [ 'jpg','gif','png','jpeg','bmp','tiff','psd' ]
    # The viewer now supports a new type of menu entry, a slideshow file.
    # It also has the slideshow alarm signal handler for automated shows.
    # It uses a new configuration option:
    # IMAGE_SSHOW_SUFFIX = [ 'ssr' ]
    # The viewer can exclude certain types of images based on the regular expression list
    # eg IMAGE_EXCLUDE = [('thm','tn_')]
    # IMAGE_EXCLUDE = None
    # Mode of the blending effect in the image viewer between two images
    # Possible values are:
    # None: no blending
    # -1 random effect
    # 0 alpha blending
    # 1 wipe effect
    IMAGEVIEWER_BLEND_MODE = -1
    # When viewing images on a TV screen where the pixels are not square
    # the images need to be scaled according to the aspect ratio of the TV
    # Use this setting for 16x9 TVs
    # IMAGEVIEWER_ASPECT = (float(1024) / float(720))
    # Use this setting for 4x3 TVs
    # IMAGEVIEWER_ASPECT = (float(768) / float(720))
    # Use this setting for Monitors including HDTVs
    # IMAGEVIEWER_ASPECT = 1.0
    # IMAGEVIEWER_ASPECT = 1.0
    # ======================================================================
    # Freevo games settings:
    # ======================================================================
    # MAME is an emulator for old arcade video games. It supports almost
    # 2000 different games! The actual emulator is not included in Freevo,
    # you'll need to download and install it separately. The main MAME
    # website is at http://www.mame.net, but the version that is used here
    # is at http://x.mame.net since the regular MAME is for Windows.
    # SNES stands for Super Nintendo Entertainment System. Freevo relies
    # on other programs that are not included in Freevo to play these games.
    # NEW GAMES SYSTEM :
    # =================
    # The GAMES_ITEMS structure is now build as follows :
    # <NAME>, <FOLDER>, (<TYPE>, <COMMAND_PATH>, <COMMAND_ARGS>, <IMAGE_PATH>, \
    # [<FILE_SUFFIX_FOR_GENERIC>])
    # where :
    # - <TYPE> : Internal game types (MAME or SNES) or
    # generic one (GENERIC)
    # - <COMMAND_PATH> : Emulator command
    # - <COMMAND_ARGS> : Arguments for the emulator
    # - <IMAGE_PATH> : Optionnal path to the picture
    # - <FILE_SUFFIX_FOR_GENERIC> : If the folder use the GENERIC
    # type, then you must specify here
    # the file suffix used by the emulator
    # GAMES_ITEMS = [
    # ('MAME', '/home/media/games/xmame/roms',
    # ('MAME', '/usr/local/bin/xmame.SDL', '-fullscreen -modenumber 6',
    # '/home/media/games/xmame/shots', None)),
    # ('SUPER NINTENDO', '/home/media/games/snes/roms',
    # ('SNES', '/usr/local/bin/zsnes', '-m -r 3 -k 100 -cs -u', '', None )),
    # ('Visual Boy Advance', '/home/media/games/vba/roms/',
    # ('GENERIC', '/usr/local/vba/VisualBoyAdvance', ' ', '', [ 'gba' ] )),
    # ('MEGADRIVE', '/home/media/games/megadrive/roms',
    # ('GENESIS', '/usr/local/bin/generator-svgalib', '', '', '' ))
    # GAMES_ITEMS = None
    # These settings are used for the MAME arcade emulator:
    # Priority of the game process
    # 0 = Don't change the priority
    # >0 - Lower priority
    # <0 - Higher priority
    # GAMES_NICE = -20
    # MAME cache directory
    # GAMES_MAME_CACHE = '%s/romlist-%s.pickled' % (FREEVO_CACHEDIR, os.getuid())
    # ======================================================================
    # Freevo SKIN settings:
    # ======================================================================
    # XML file for the skin. If SKIN_XML_FILE is set, this skin will be
    # used, otherwise the skin will rememeber the last choosen skin.
    # SKIN_XML_FILE = 'blurr'
    # Select a way when to switch to text view even if a image menu is there
    # 1 = Force text view when all items have the same image and there are no
    # directories
    # 2 = Ignore the directories, always switch to text view when all images
    # are the same
    # SKIN_FORCE_TEXTVIEW_STYLE = 1
    # Force text view for the media menu
    # (The media menu is the first menu displayed for video, audio, images
    # and games).
    # SKIN_MEDIAMENU_FORCE_TEXTVIEW = 0
    # ======================================================================
    # Freevo OSD settings:
    # ======================================================================
    # System Path to search for fonts not included in the Freevo distribution
    # OSD_EXTRA_FONT_PATH = [ '/usr/share/fonts/truetype' ]
    # Font aliases
    # All names must be lowercase! All alternate fonts must be in './share/fonts/'
    # OSD_FONT_ALIASES = { 'arial_bold.ttf' : 'VeraBd.ttf' }
    # For non-european character sets the OSD_FORCE_FONTNAME and
    # OSD_FORCE_FONTSIZE can be set. The size is a scaling ratio, ie 1.2.
    # Setting OSD_FORCE_FONTNAME='batang.ttf' and OSD_FORCE_FONTSIZE=1.0
    # allows Korean characters.
    # OSD_FORCE_FONTNAME = None
    # OSD_FORCE_FONTSIZE = None
    # Number of seconds to wait until the busy icon is shown in the menu.
    # Busy icon can also be shown right away when there is more than a certain
    # number of files in a directory.
    # Set this to None to disable this.
    # (seconds, files)
    # OSD_BUSYICON_TIMER = (0.7, 200)
    # Number of pixels to move the display to centre the OSD on the display
    # OSD_OVERSCAN_LEFT = OSD_OVERSCAN_RIGHT = 0
    # OSD_OVERSCAN_TOP = OSD_OVERSCAN_BOTTOM = 0
    # Setting the cursors when freevo is run in fullscreen mode
    # OSD_X11_CURSORS = '/usr/lib/X11/cursors/black.cursor /usr/lib/X11/cursors/blank.cursor'
    # Execute a script on OSD startup.
    # OSD_SDL_EXEC_AFTER_STARTUP = ""
    # Execute a script on OSD close.
    # OSD_SDL_EXEC_AFTER_CLOSE = ""
    # Stop the osd before playing a movie with xine or mplayer. Some output
    # devices need this. After playback, the osd will be restored
    # OSD_STOP_WHEN_PLAYING = 0
    # Dim text that doesn't fit instead of using ellipses.
    # OSD_DIM_TEXT = 1
    # OSD sound effects
    # OSD_SOUNDS_ENABLED=False
    # OSD_SOUNDS= {
    # 'menu.navigate': None,
    # 'menu.back_one': None,
    # 'menu.select' : None
    # ======================================================================
    # Freevo remote control settings:
    # ======================================================================
    # Location of the lircrc file
    # For remote control support, Freevo needs a lircrc file, like this:
    # begin
    # prog = freevo
    # button = select
    # config = SELECT
    # end
    # Check contrib/lirc for examples and helpers/freevo2lirc.pl for a converter
    # script.
    # LIRCRC = '/etc/freevo/lircrc'
    # Joystick support
    # 0 = Disable joystick support
    # 1 = Use js0,
    # 2 = Use js1,
    # ... etc
    # JOY_DEV = 0
    # JOY_SENS = 32000
    # JOY_LOCKFILE = /path/to/joystick/lockfile
    # Freevo can support as many buttons as your controller has
    # as long as there is a corresponding entry in JOY_CMDS.
    # You will also need to plugin.activate('joy').
    # FYI: new kernels use /dev/input/jsX, but joy.py will fall back on /dev/jsX
    # JOY_CMDS = {
    # 'up' : 'UP',
    # 'down' : 'DOWN',
    # 'left' : 'LEFT',
    # 'right' : 'RIGHT',
    # 'button 1' : 'PLAY',
    # 'button 2' : 'PAUSE',
    # 'button 3' : 'STOP',
    # 'button 4' : 'ENTER',
    # Here are the PS3 joy stick mappings
    # JOY_CMDS = {
    # 'button 5' : 'UP',
    # 'button 7' : 'DOWN',
    # 'button 8' : 'LEFT',
    # 'button 6' : 'RIGHT',
    # 'up' : 'UP',
    # 'down' : 'DOWN',
    # 'left' : 'LEFT',
    # 'right' : 'RIGHT',
    # 'button 14' : 'SELECT', # <circle>
    # 'button 16' : 'EXIT', # <square>
    # 'button 15' : 'STOP', # <x>
    # 'button 1' : 'ENTER', # <select>
    # 'button 11' : 'VOL+', # <L1>
    # 'button 9' : 'VOL-', # <L2>
    # 'button 2' : 'MUTE', # <L3>
    # 'button 10' : 'MUTE', # <R2>
    # 'button 4' : 'PLAY', # <start>
    # 'button 13' : 'PLAY', # <start>
    # 'button 17' : 'MENU', # <ps>
    # ======================================================================
    # TVtime settings:
    # ======================================================================
    # Location of the TV time program
    # Default: Use the value in freevo.conf
    # TVTIME_CMD = CONF.tvtime
    # ======================================================================
    # MPlayer settings:
    # ======================================================================
    # MPLAYER_AO_DEV = 'oss:/dev/dsp' # e.g.: oss,sdl,alsa, see mplayer docs
    # MPLAYER_VO_DEV_OPTS = '' # e.g.: ':some_var=vcal'
    # DVD_LANG_PREF = 'en,se,no' # Order of preferred languages on DVD.
    # DVD_SUBTITLE_PREF = '' # Order of preferred subtitles on DVD.
    # Priority of mplayer process. 0 is unchanged, <0 is higher prio, >0 lower prio.
    # prio <0 has no effect unless run as root.
    # MPLAYER_NICE = -20
    # Mplayer options to use the software scaler. If your CPU is fast enough, you
    # might try a software scaler. You can disable it later for some larger files
    # with the mplayer option '-nosws'. If you have -framedrop or -hardframedrop
    # as mplayer option, the software scaler will also not be used.
    # A good value for this variable is:
    # MPLAYER_SOFTWARE_SCALER = "-subfont-text-scale 5 -fs -sws 2 -vf scale=%s:-3,"\
    # "expand=%s:%s " % ( CONF.width, CONF.width, CONF.height )
    # older versions of mplayer may need
    # MPLAYER_SOFTWARE_SCALER = '-xy %s -sws 2 -vop scale:-1:-1:-1:100' % CONF.width
    # MPLAYER_SOFTWARE_SCALER = ''
    # Mplayer arguments for different media formats. (eg DVDs, CDs, AVI files, etc)
    # Uses a default value if nothing else matches.
    # MPLAYER_ARGS = { 'dvd' : '-cache 8192',
    # 'vcd' : '-cache 4096',
    # 'cd' : '-cache 1024 -cdda speed=2',
    # 'tv' : '-nocache',
    # 'ivtv' : '-cache 8192',
    # 'avi' : '-cache 5000 -idx',
    # 'rm' : '-cache 5000 -forceidx',
    # 'rmvb' : '-cache 5000 -forceidx',
    # 'webcam' : 'tv:// -tv driver=v4l:width=352:height=288:outfmt=yuy2:device=/dev/video2',
    # 'default': '-cache 5000'
    # Number of seconds before seek value times out. This is used when
    # seeking a specified number of minutes into a movie. If you make
    # a mistake or change your mind, the seek value will timeout after
    # this many seconds.
    # MPLAYER_SEEK_TIMEOUT = 8
    # Autocrop files when playing. This is useful for files in 4:3 with black
    # bars on a 16:9 tv
    # MPLAYER_AUTOCROP = 0
    # Try to set correct 'delay' and 'mc' values for mplayer based on the delay
    # from mmpython.
    # This should correct av sync problems with mplayer for some files, but
    # may also break things. (I don't know, that's why it's disabled by default).
    # WARNING: When seeking, the playback is out of sync for some seconds!
    # MPLAYER_SET_AUDIO_DELAY = 0
    # Mplayer video filter for interlaced or progressive videos. If you have
    # a slow pc, do not use post processing
    # MPLAYER_VF_INTERLACED = ''
    # MPLAYER_VF_PROGRESSIVE = 'pp=fd'
    # For pal and dvb-t recordings, the following looks good
    # MPLAYER_VF_INTERLACED = 'pp=md/de,phase=U'
    # MPLAYER_VF_INTERLACED = 'pp=de/fd'
    # MPLAYER_VF_PROGRESSIVE = 'pp=de'
    # For the autodetect TOP/BOTTOM field first in mplayer
    # (if this feature present in mplayer)
    # MPLAYER_HAS_FIELD_DOMINANCE = 1
    # ======================================================================
    # Xine settings:
    # ======================================================================
    # You need xine-ui version greater 0.9.21 to use the all the features
    # of the xine plugin
    # XINE_VO_DEV = 'xv'
    # XINE_COMMAND = '%s --auto-play=fq --hide-gui --borderless --geometry %sx%s+0+0 --no-splash' % \
    # (CONF.xine, CONF.width, CONF.height)
    # XINE_ARGS_DEF = "--no-lirc --post='pp:quality=10;expand'"
    # XINE_AO_DEV = 'oss' # alsa or oss
    # Set to False if xine doesn't have '--no-lirc' option
    # XINE_HAS_NO_LIRC = True
    # Set to True is xine supports get_time this enables the position to be saved
    # XINE_BOOKMARK = False
    # ======================================================================
    # Freevo TV settings:
    # ======================================================================
    # This is where recorded video is written.
    # XXX the path doesn't work from the www cgi scripts!
    # TV_RECORD_DIR = None
    # This will enable duplicate recording detection
    # TV_RECORD_DUPLICATE_DETECTION = True
    # This will enable only new episodes to be recorded
    # TV_RECORD_ONLY_NEW_DETECTION = True
    # ================================================================================
    # Watching TV
    # ================================================================================
    # XXX You must change this to fit your local conditions!
    # NORM: ntsc, pal, secam
    # INPUT: television, composite1
    # CHANLIST: One of the following:
    # us-bcast, us-cable, us-cable-hrc, japan-bcast, japan-cable, europe-west,
    # europe-east, italy, newzealand, australia, ireland, france, china-bcast,
    # southafrica, argentina, canada-cable, russia
    # TV_SETTINGS = 'NORM INPUT CHANLIST DEVICE'
    # Video input device
    # Usually /dev/video0, but might be /dev/video1 instead for multiple boards.
    # FreeBSD uses the Brooktree TV-card driver, not V4L.
    # TV_DRIVER = 'v4l'
    # TV_DEVICE = '/dev/video0'
    # TV_INPUT = 0
    # ================================================================================
    # Listening to radio
    # ================================================================================
    # Radio device default is None, /dev/video24 for ivtv
    # RADIO_DEVICE = '/dev/radio'
    # Radio commands:
    # plugin.activate('audio.radioplayer')
    # plugin.activate('audio.radio')
    # for fmtools
    # RADIO_CMD = 'fm'
    # RADIO_CMD_START = (RADIO_CMD + ' -d %s ' % RADIO_DEVICE + ' -q %s 65535')
    # RADIO_CMD_STOP = (RADIO_CMD + ' -d %s ' % RADIO_DEVICE + ' -q off')
    # for ivtv-radio
    # RADIO_CMD = '/usr/bin/ivtv-radio -d /dev/radio0 -i /dev/video24'
    # RADIO_STATIONS = [
    # ('DRS 1', '94.80'),
    # ('VIRUS', '104.30'),
    # (u'Radio Zürisee', '90.20'),
    # Additional options to pass to mplayer in TV mode.
    # eg. To turn off deinterlacing:
    # TV_OPTS = '-vop pp=ci'
    # TV_OPTS = ''
    # TV_SETTINGS = '%s television %s %s' % (CONF.tv, CONF.chanlist, TV_DEVICE)
    # Size (in MB) of the timeshift buffer. (ie: how long you can pause tv for.)
    # This is set to a low default because the default buffer location is
    # under FREEVO_CACHEDIR and we don't want to blow /var or /tmp.
    # TIMESHIFT_BUFFER_SIZE = 128
    # TIMESHIFT_ENCODE_CMD = 'mp1e -m3 -c%s -p%s -r14,100' % \
    # (TV_SETTINGS.split()[3], AUDIO_INPUT_DEVICE)
    # TIMESHIFT_BUFFER = '%s/timeshift.mpeg' % FREEVO_CACHEDIR
    # TV_DATE_FORMAT = '%e-%b' # Day-Month: 11-Jun
    # TV_TIME_FORMAT = '%H:%M' # Hour-Minute 14:05
    # TV_DATETIME_FORMAT = '%A %b %d %I:%M %p' # Thursday September 24 8:54 am
    # This is the filename format for files recorded using Freevo.
    # You can use any of the strftime variables in it, provided you
    # put two '%%' at the beginning.
    # Some examples:
    # %%A - Full weekday name.
    # %%H - Hour (24-hour clock) as a decimal number [00,23].
    # %%M - Minute as a decimal number [00,59].
    # %%m - Month as a decimal number [01,12].
    # %%d - Day of the month as a decimal number [01,31].
    # %%p - Locale's equivalent of either AM or PM.
    # More can be found at: http://www.python.org/doc/current/lib/module-time.html
    # TV_RECORD_FILE_MASK = '%%m-%%d %%H:%%M %(progname)s - %(title)s'
    # If using the persistent recordserver
    # TV_RECORD_SCHEDULE = FREEVO_STATICDIR + '/schedule.pickle'
    # TV_RECORD_FAVORITES = FREEVO_STATICDIR + '/favorites.pickle'
    # TV_RECORD_FAVORITES_LIST = FREEVO_STATICDIR + '/favorites.txt'
    # RECORDSERVER_IP = 'localhost'
    # RECORDSERVER_PORT = 18001
    # RECORDSERVER_SECRET = 'secret1'
    # If the recordserver runs as root, set the uid to the given one
    # after startup. The gui must also match one of the users group ids
    # RECORDSERVER_UID = 0
    # RECORDSERVER_UID = 0
    # Remove old recordings if GB free is less than specified value
    # RECORDSERVER_CLEANUP_THRESHOLD = 0
    # start every recording X minutes before scheduled,
    # and stop X minutes after scheduled - default to zero minutes.
    # This must be a value in seconds although at the moment only has
    # the percision of one minute.
    # TV_RECORD_PADDING_PRE = 0
    # TV_RECORD_PADDING_POST = 0
    # Number of minutes before or after the start time of a favorite where
    # a program matching the name, day of week etc should still be considered a
    # favorite. For example a favorite has a start time of 21.00, but the program
    # has been brought forward by the broadcaster by 10 minutes to 20.50, with
    # a margin of less than 10 this program will not be recorded as the start time
    # is outside the margin. But if the margin is set at 10 minutes or greater this
    # program will be considered a favorite and recorded. Probably about 45 minutes
    # is the best bet, better a false positive than a false negative.
    # TV_RECORD_FAVORITE_MARGIN = 45
    # PRE and POST recording commands. Set these to a runnable command if
    # you wish to have special mixer settings or video post processing.
    # VCR_PRE_REC = None
    # VCR_POST_REC = None
    # VCR_AUDIO = (':adevice=%s' % AUDIO_DEVICE +
    # ':audiorate=32000' + # 44100 for better sound
    # ':forceaudio:forcechan=1:' + # Forced mono for bug in my driver
    # 'buffersize=64') # 64MB capture buffer, change?
    # TV capture size for viewing and recording. Max 768x480 for NTSC,
    # 768x576 for PAL. Set lower if you have a slow computer!
    # For the 'tvtime' TV viewing application, only the horizontal size is used.
    # Set the horizontal size to 400 or 480 if you have a slow (~500MHz) computer,
    # it still looks OK, and the picture will not be as jerky.
    # The vertical size is always either fullscreen or 480/576 (NTSC/PAL)
    # for tvtime.
    # TV_VIEW_SIZE = (640, 480)
    # TV_REC_SIZE = (320, 240) # Default for slower computers
    # Input formats for viewing and recording. The format affect viewing
    # and recording performance. It is specific to your hardware, so read
    # the MPlayer docs and experiment with mplayer to see which one fits
    # your computer best.
    # TV_VIEW_OUTFMT = 'yuy2' # Better quality, slower on pure FB/X11
    # TV_REC_OUTFMT = 'yuy2'
    # XXX Please see the mencoder docs for more info about the settings
    # XXX below. Some stuff must be changed (adevice), others probably
    # XXX should be ("Change"), or could be in some cases ("change?")
    # VCR_CMD = (CONF.mencoder + ' ' +
    # 'tv:// ' + # New mplayer requires this.
    # '-tv driver=%s:input=%d' % (TV_DRIVER, TV_INPUT) +
    # ':norm=%s' % CONF.tv +
    # ':channel=%(channel)s' + # Filled in by Freevo
    # ':chanlist=%s' % CONF.chanlist +
    # ':width=%d:height=%d' % (TV_REC_SIZE[0], TV_REC_SIZE[1]) +
    # ':outfmt=%s' % TV_REC_OUTFMT +
    # ':device=%s' % TV_DEVICE +
    # VCR_AUDIO + # set above
    # ' -ovc lavc -lavcopts ' + # Mencoder lavcodec video codec
    # 'vcodec=mpeg4' + # lavcodec mpeg-4
    # ':vbitrate=1200:' + # Change lower/higher, bitrate
    # 'keyint=30 ' + # Keyframe every 10 secs, change?
    # '-oac mp3lame -lameopts ' + # Use Lame for MP3 encoding, must be enabled in mencoder!
    # 'br=128:cbr:mode=3 ' + # MP3 const. bitrate, 128 kbit/s
    # '-ffourcc divx ' + # Force 'divx' ident, better compat.
    # '-endpos %(seconds)s ' + # only mencoder uses this so do it here.
    # '-o %(filename)s') # Filled in by Freevo
    # TV_VIDEO_GROUPS setting to handles multiple arbitrary groups of devices
    # for viewing or recording. It is possible to have different Freevo
    # channels use different Video Groups.
    # See the wiki for more details:
    # http://doc.freevo.org/MultiTunerConfig
    # http://doc.freevo.org/Analoguemulti
    # This example is when you have one IVTV type card installed
    # TV_VIDEO_GROUPS = [
    # VideoGroup(vdev=TV_DEVICE,
    # adev=AUDIO_DEVICE,
    # input_type='tuner 1',
    # input_num=0,
    # tuner_norm=CONF.tv,
    # tuner_chanlist=CONF.chanlist,
    # group_type = 'ivtv',
    # desc='PVR-350 Video Group'),
    # This example is for two normal TV cards to allow you to use one card to
    # view a programme and the other card to record at the same time
    # TV_VIDEO_GROUPS = [
    # # Use this group for watching tv
    # VideoGroup(vdev='/dev/video0',
    # adev=None,
    # input_type='tuner 1',
    # tuner_norm=CONF.tv,
    # tuner_chanlist=CONF.chanlist,
    # desc='Watching Video Group',
    # record_group=1),
    # # Use this group for recording tv
    # VideoGroup(vdev='/dev/video1',
    # adev=None,
    # input_type='tuner 1',
    # tuner_norm=CONF.tv,
    # tuner_chanlist=CONF.chanlist,
    # desc='Recording Video Group',
    # record_group=None),
    # Settings for ivtv based cards such as the WinTV PVR-250/350.
    # TODO: Add descriptions and valid settings for each option.
    # bitrate in bps
    # stream type
    # Options are: 0 (mpeg2_ps), 1 (mpeg2_ts), 2 (mpeg1), 3 (mpeg2_pes_av),
    # 5 (mpeg2_pes_v), 7 (mpeg2_pes_a), 10 (dvd)
    # TV_IVTV_OPTIONS = {
    # 'input' : 4,
    # 'resolution' : '720x480',
    # 'aspect' : 2,
    # 'audio_bitmask' : 233,
    # 'bframes' : 3,
    # 'bitrate_mode' : 1,
    # 'bitrate' : 4000000,
    # 'bitrate_peak' : 4000000,
    # 'dnr_mode' : 0,
    # 'dnr_spatial' : 0,
    # 'dnr_temporal' : 0,
    # 'dnr_type' : 0,
    # 'framerate' : 0,
    # 'framespergop' : 15,
    # 'gop_closure' : 1,
    # 'pulldown' : 0,
    # 'stream_type' : 10,
    # TV Channels. This list contains a mapping from the displayed channel name
    # to the actual channel name as used by the TV watching application.
    # The display name must match the names from the XMLTV guide,
    # and the TV channel name must be what the tuner expects (usually a number).
    # The TV menu is supposed to be supported by the XMLTV application for
    # up to date listings, but can be used without it to just display
    # the available channels.
    # This list also determines the order in which the channels are displayed!
    # N.B.: You must delete the XMLTV cache file (e.g. /var/cache/freevo/TV.xml.pickled)
    # if you make changes here and restart!
    # Format: [('xmltv channel id', 'freevo display name', 'tv channel name'), ...]
    # If this variable is set to None (default), Freevo will try to auto-detect
    # the channel list based on the xmltv file. This doesn't work for all
    # xmltv grabber, e.g. the German list doesn't contain station lists. In this
    # case Freevo will output the possible list for you to add them manually.
    # If auto-detection doesn't work or you want to edit the list, run
    # freevo tv_grab -query.
    # Setting this variable to [] will deactivate the tv guide. If you don't have
    # a tv card, you may also want to add plugin.remove('tv') to remove the whole
    # tv menu.
    # All channels listed here will be displayed on the TV menu, even if they're
    # not present in the XMLTV listing.
    # Timedependent channels:
    # The TV_CHANNELS-list can look like this:
    # TV_CHANNELS = [('21', 'SVT1', 'E5'),
    # ('22', 'SVT2', 'E3'),
    # ('26', 'TV3', 'E10'),
    # ('27', 'TV4', 'E6'),
    # ('10', 'Kanal 5', 'E7'),
    # ('60', 'Fox Kids', 'E8', ('1234567','0600','1659')),
    # ('16', 'TV6', 'E8', ('1234567','1700','2359'),
    # ('1234567','0000','0300')),
    # ('14', 'MTV Europe', 'E11') ]
    # As you can see the list takes optional tuples:
    # ( 'DAYS', 'START','END')
    # 1234567 in days means all days.
    # 12345 would mean monday to friday.
    # It will display "Fox Kids" from 06:00 to 16:59 and "TV6" from 17:00 to 03:00.
    # 03:00 to 06:00 it won't be displayed at all.
    # TV_CHANNELS = None
    # A lambda function to sort the TV_CHANNELS
    #TV_CHANNELS_COMPARE = lambda a, b: cmp(int(a[2]), int(b[2]))
    # TV_FREQUENCY_TABLE - This is only used when Freevo changes the channel natively.
    # This is only the case if you are using V4L2 and any of the following plugins:
    # timeshift, ivtv_record, ivtv_basic_tv.
    # For the standard frequancy tables see src/tv/freq.py. To add your own just
    # replace tuner_id in the following example with a valid tuner id (ie: '5' or
    # 'BBC1') and a frequency in KHz. You may have as many entries as you like,
    # anything here will simply override a corresponding entry in your standard
    # frequency table and you can also have entries here that are not present in
    # there.
    # TV_FREQUENCY_TABLE = {
    # 'tuner_id' : 55250,
    # Program to grab xmltv listings. To get a grabber, you need to download
    # xmltv. A possible value for users in the USA is tv_grab_na
    # Use the tv_grab helper to grab the listings and cache them. Start
    # 'freevo tv_grab --help' for more informations.
    # XMLTV_GRABBER = ''
    # If you want to run tv_sort on your listings add the path to tv_sort here.
    # tv_sort will make sure all your programs have proper stop times, otherwise
    # programs might get cut off at midnight.
    # XMLTV_SORT = ''
    # Number of days the grabber should get
    # XMLTV_DAYS = 3
    ## ONLY ADJUST THIS IF YOUR GUIDE TIMES ARE INCORRECT ##
    # GMT offset for XMLTV feeds that don't contain timezone information
    # An example of this is the OzTivo feed which has the timestamps
    # in the XML pre-adjusted for your timezone
    # XMLTV_TIMEZONE='+0100'
    # ======================================================================
    # Freevo builtin commdetect server settings:
    # ======================================================================
    # COMMDETECTSERVER_UID = 0
    # COMMDETECTSERVER_GID = 0
    # COMMDETECTSERVER_IP = 'localhost'
    # COMMDETECTSERVER_PORT = 6667
    # ======================================================================
    # Freevo builtin rss server settings:
    # ======================================================================
    # RSSSERVER_UID = 0
    # RSSSERVER_GID = 0
    # RSS_CHECK_INTERVAL = 3600
    # RSS_FEEDS = '/etc/freevo/rss.feeds'
    # RSS_VIDEO = '/media/video'
    # RSS_AUDIO = '/media/podcasts'
    # ======================================================================
    # Freevo builtin WWW server settings:
    # ======================================================================
    # To activate the built in web server, uncomment the following line
    # plugin.activate('www')
    # Web server port number. 80 is the standard port, but is often
    # taken already by apache, and cannot be used unless the server
    # runs as root. Port 8080 is the default, change to 80 if
    # needed.
    # WEBSERVER_PORT = 8080
    # Username / Password combinations to login to the web interface.
    # WWW_USERS = {
    # "user1" : "changeme",
    # "optional" : "changeme2"
    # Divide the TV guide into intervals of this length (in minutes)
    # WWW_GUIDE_INTERVAL = 30
    # Precision for TV guide (in minutes)
    # WWW_GUIDE_PRECISION = 5 #
    # Show this many blocks at once
    # WWW_GUIDE_COLS = 6
    # WWW_STYLESHEET = 'styles/main.css'
    # WWW_JAVASCRIPT = 'scripts/display_prog-head.js'
    # Integrate personal web pages into the web server
    # WWW_PERSONAL_PAGE = [
    # ('My Page', 'a single personal web page', 'page.html'),
    # ('My Site', 'site description', 'site/'),
    # ======================================================================
    # Internal stuff, you shouldn't change anything here unless you know
    # what you are doing
    # ======================================================================
    # Config for xml support in the movie browser
    # the regexp has to be with ([0-9]|[0-9][0-9]) so we can get the numbers
    # VIDEO_SHOW_REGEXP = "s?([0-9]|[0-9][0-9])[xe]([0-9]|[0-9][0-9])[^0-9]"
    # Remote control daemon. The server is in the Freevo main application,
    # and the client is a standalone application in rc_client/
    # ENABLE_NETWORK_REMOTE = 0
    # REMOTE_CONTROL_HOST = '127.0.0.1'
    # REMOTE_CONTROL_PORT = 16310
    # Remote control daemon. Similar to the one above, but uses TCP instead
    # of UDP. It is possible to send commands with a telnet client.
    # ENABLE_TCP_NETWORK_REMOTE = 0
    # REMOTE_CONTROL_TCP_HOST = '127.0.0.1'
    # REMOTE_CONTROL_TCP_PORT = 16311
    # XMLTV File
    # This is the XMLTV file that can be optionally used for TV listings
    # XMLTV_FILE = '/tmp/TV.xml'
    # XML TV Logo Location
    # Use the "makelogos.py" script to download all the
    # Station logos into a directory. And then put the path
    # to those logos here
    # TV_LOGOS = OS_CACHEDIR + '/xmltv/logos'
    # ======================================================================
    # Idlebar and plugins
    # These are the default idlebar settings, there are many more see:
    # freevo plugins -l for a complete list
    # To turn off use plugin.remove('idlebar.cdstatus')
    # clock display
    # %A - Full weekday name.
    # %a - Abbreviated weekday name.
    # %B - Full month name
    # %b - Abbreviated month name
    # %I - Hour (12-hour clock) as a decimal number [01,12].
    # %H - Hour (24-hour clock) as a decimal number [00,23].
    # %M - Minute as a decimal number [00,59].
    # %m - Month as a decimal number [01,12].
    # %b - Name of Month
    # %d - Day of the month as a decimal number [01,31].
    # %p - Locale's equivalent of either AM or PM.
    # %y - Year without century as a decimal number [00,99].
    # %Y - Year with century as a decimal number.
    # ======================================================================
    # plugin.activate('idlebar')
    # plugin.activate('idlebar.tv', level=20)
    # plugin.activate('idlebar.cdstatus', level=25)
    # plugin.activate('idlebar.diskfree', level=30)
    # plugin.activate('idlebar.clock', level=50)
    # CLOCK_FORMAT = '%a %d %H:%M'
    # Debugging and logging settings
    # logging can be one of:
    # CRITICAL, ERROR, WARNING, INFO, DEBUG or NOTSET
    # debugging is a number from 0 to 9, 0 is no debugging 9 is most
    # LOGGING = logging.DEBUG
    # LOGGING_RECORDSERVER = logging.DEBUG
    # DEBUG = 1
    # messages go to stdout
    # DEBUG_STDOUT = 0
    # messages from starting a child application
    # DEBUG_CHILDAPP = 1
    # timing messages
    # DEBUG_TIME = 0
    I've been reading wikis and googling now the entire weekend so I hope someone here can help me.

    Perre wrote:I'm used to being able to pick one or a couple of songs and then adding it a specified playlist. Is this impossible in sonata?
    It's clearly not impossible, just different than you expect. Create your playlist as you want it to appear in the Current tab (meaning don't dump every single song from your library in there, just the ones you want) and then save the playlist.
    Perre wrote:And if I try to play the m3u file created (the one with every song listed) through freevo I get a message that the directory is empty. What am I doing wrong??
    Look at save_absolute_paths_in_playlists in your mpd.conf.

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

  • PL/SQL Mail Utility :: Binary/Ascii/Cc/Bcc/FileDump

    I was working on my mail package and decided it was overtly complicated and
    stripped it down to its bare bones. Here is what I came up with. Built on a previous
    foundation of anothers work, I expanded the functionality considerably. You will find all
    the features I think that you will need regarding a mail routine. There is also a nice
    filedump routine included which makes very easy to create flat file dumps that you can
    then attach to your emails. There are a few pre-reqs in using this though :
    - 9iR2+
    - DBA_Directories defined as opposed to utl_file paths
    - Java Virtual Machine. Document can be found in “Note :105472.1 Setup, Configuration,
    and Use of the Java Virtual Machine” on metalink.
    As always, I welcome feedback and suggestions for improvement.
    Barry C
    http://www.myoracleportal.com
    CREATE OR REPLACE PACKAGE mail_tools
    AS
    -- SENDMAIL supports variable message length with/without attachments
    -- QUERY_SERVER allows you to check the status of a mail server to see if it is running
    -- DUMP_FLATFILE allows you to dump flat file data from query submitted
    -- Query Server to verify that the server is up and running.
    -- Connects, Noop Command is executed, Disconnect.
    -- GET_MAIL_ADDRESS is utilized in the SENDMAIL procedure
    -- Table 100-3 SMTP Reply Codes
    -- Reply Code
    -- Meaning
    -- 211 System status, or system help reply
    -- 214 Help message [Information on how to use the receiver or the meaning of a particular non-standard command; this reply is useful only to the human user]
    -- 220 <domain> Service ready
    -- 221 <domain> Service closing transmission channel
    -- 250 Requested mail action okay, completed
    -- 251 User not local; will forward to <forward-path>
    -- 252 OK, pending messages for node <node> started. Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.
    -- 253 OK, <messages> pending messages for node <node> started
    -- 354 Start mail input; end with <CRLF>.<CRLF>
    -- 355 Octet-offset is the transaction offset
    -- 421 <domain> Service not available, closing transmission channel (This may be a reply to any command if the service knows it must shut down.)
    -- 450 Requested mail action not taken: mailbox unavailable [for example, mailbox busy]
    -- 451 Requested action aborted: local error in processing
    -- 452 Requested action not taken: insufficient system storage
    -- 453 You have no mail.
    -- 454 TLS not available due to temporary reason. Encryption required for requested authentication mechanism.
    -- 458 Unable to queue messages for node <node>
    -- 459 Node <node> not allowed: reason
    -- 500 Syntax error, command unrecognized (This may include errors such as command line too long.)
    -- 501 Syntax error in parameters or arguments
    -- 502 Command not implemented
    -- 503 Bad sequence of commands
    -- 504 Command parameter not implemented
    -- 521 <Machine> does not accept mail.
    -- 530 Must issue a STARTTLS command first. Encryption required for requested authentication mechanism.
    -- 534 Authentication mechanism is too weak.
    -- 538 Encryption required for requested authentication mechanism.
    -- 550 Requested action not taken: mailbox unavailable [for , mailbox not found, no access]
    -- 551 User not local; please try <forward-path>
    -- 552 Requested mail action aborted: exceeded storage allocation
    -- 553 Requested action not taken: mailbox name not allowed [for example, mailbox syntax incorrect]
    -- 554 Transaction failed
    This version allows for a customized seperator value. Using this function will allow you to
    perform fixed width flat files by defining '' for no seperator and then RPAD/LPAD your columns as necessary.
    Or use whatever seperator you wish to use, pipe, space, zeros, etc.
       --  Example : This will generate a flat file which tabbed seperated
    -- DECLARE
    --    l_rows   NUMBER;
    --    l_sql    VARCHAR2(32000);
    -- BEGIN
    --    l_sql := '
    -- SELECT   rpad(hou.NAME,70) udn_desc
    -- ,        rpad(pcak.segment1,6) coid
    -- ,        rpad(pcak.segment2,4) udn
    --     FROM hr_all_organization_units hou, hr.pay_cost_allocation_keyflex pcak
    --    WHERE TRUNC (SYSDATE) BETWEEN hou.date_from
    --                              AND NVL (hou.date_to, ''31-DEC-4712'')
    --      AND pcak.cost_allocation_keyflex_id = hou.cost_allocation_keyflex_id
    -- GROUP BY pcak.segment1, pcak.segment2, hou.NAME
    -- ORDER BY 1, 2, 3
    --    l_rows :=
    --       dump_flatfile
    --          (p_query          =>
    -- ,         p_dir            => 'INTF000_TABLES'
    -- ,         p_filename       => 'test.csv'
    -- ,       p_separator     => '     ' -- <= tabbed 5 spaces between each column
    -- ,       p_max_linesize   => 32000
    -- ,       p_mode       => 'w' -- (w)rite mode or (a)ppend mode
    -- END;
       FUNCTION dump_flatfile (
          p_query                    IN       VARCHAR2
    ,     p_dir                      IN       VARCHAR2
    ,     p_filename                 IN       VARCHAR2
    ,     p_separator                IN       VARCHAR2
    ,     p_headers                  IN       BOOLEAN DEFAULT FALSE
    ,     p_trailing_separator       IN       BOOLEAN DEFAULT FALSE
    ,     p_max_linesize             IN       NUMBER DEFAULT 32000
    ,     p_mode                     IN       VARCHAR2 DEFAULT 'w' )
          RETURN NUMBER;
       FUNCTION get_mail_address (
          addr_list                  IN OUT   VARCHAR2 )
          RETURN VARCHAR2;
       FUNCTION smtp_command (
          command                    IN       VARCHAR2
    ,     ok                         IN       VARCHAR2 DEFAULT '250'
    ,     code                       OUT      VARCHAR2
    ,     DEBUG                               NUMBER DEFAULT 0 )
          RETURN BOOLEAN;
       FUNCTION query_server (
          smtp_server                         VARCHAR2
    ,     smtp_server_port                    PLS_INTEGER DEFAULT 25
    ,     DEBUG                               NUMBER DEFAULT 0 )
          RETURN BOOLEAN;
    This procedure uses the UTL_TCP package to send an email message.
    Up to three file names may be specified as attachments.
    Written: Dave Wotton, 14/6/01 (Cambridge UK)
    This script comes with no warranty or support. You are free to
    modify it as you wish, but please retain an acknowledgement of
    my original authorship.
    Amended: Dave Wotton, 10/7/01
    Now uses the utl_smtp.write_data() method to send the message,
    eliminating the 32Kb message size constraint imposed by the
    utl_smtp.data() procedure.
    Amended: Dave Wotton, 20/7/01
    Increased the v_line variable, which holds the file attachment
    lines from 400 to 1000 bytes. This is the maximum supported
    by RFC2821, The Simple Mail Transfer Protocol specification.
    Amended: Dave Wotton, 24/7/01
    Now inserts a blank line before each MIME boundary line. Some
    mail-clients require this.
    Amended: Dave Wotton, 4/10/01
    Introduced a 'debug' parameter. Defaults to 0. If set to
    non-zero then errors in opening files for attaching are
    reported using dbms_output.put_line.
    Include code to hand MS Windows style pathnames.
    Amended: Barry Chase, 4/29/03
    Added Priority to procedure and also X-Mailer ID.
    Removed restrictions for email size limitation as well.
    Emails are now formatted text messages, meaning you can
    write your message in html format.
    And finally, changed from using UTL_SMTP to UTL_TCP instead.
    Amended: Barry Chase 11/10/2003
    Added session timeout of 4 minutes to prevent hanging server connections
    Amended: Barry Chase 12/04/2003
    Added Date String so that it represents timezone of originating server
    p_datestring
    Amended: Barry Chase 03/01/2004
    Added functionality to support binary attachments and remote attachments.
    Its about 98% complete. Not work perfectly yet. Still trying to figure out
    encoding to base64 or mime. Have a good start on it though.
    04/12/2004
    BCHASE :: Binary Support is fully functional now.
    09/01/2005
    BCHASE :: Modified attachment directories to use DBA_DIRECTORIES instead
    of UTL_DIR in the Oracle initialization file.
    02/22/2006
    BCHASE :: Added variable length message email support (CLOB)
    04/21/2006
    BCHASE :: Expanded functionality to include Cc and Bcc
    Also removed redundant calls from package. The single
    mail_files command will handle flat files and binary files such as zip/pdf/etc.
    SMTP Server and SMTP Server Port are parameters on the sendmail procedure now
    as well.
    Refer to http://home.clara.net/dwotton/dba/oracle_smtp.htm for more
    details on the original source code.
    For information on the enhanced mail_tools package as provided by Barry
    Chase, refer to http://www.myoracleportal.com
       /* Retrieves local binary file from database server.
        * using DBMS_LOB commands and stores into BLOB
        * return BLOB
       FUNCTION get_local_binary_data (
          p_dir                      IN       VARCHAR2
    ,     p_file                     IN       VARCHAR2 )
          RETURN BLOB;
    /* Supports binary attachments and message of variable length. Uses CLOB.*/
    -- DECLARE
    -- t_blob BLOB;
    -- BEGIN
    -- Use the get_local_binary_data to collect your BLOB from the filesystem
    -- or just load from a table where your BLOB is stored at, then just pass
    -- as t_blob on the binaryfile parameter below. Remember to provide an
    -- appropriate filename. Optionally, you can leave filename NULL and pass
    -- the binaryfile parameter as EMPTY_BLOB() to send an email without an
    -- attachment.
    --   t_blob :=
    --    mail_tools.get_local_binary_data
    --                   ( p_dir =>                         'INTF0047_TABLES'
    --,                    p_file =>                        'test_file1.csv' );
    --    mail_tools.sendmail
    --             ( smtp_server =>                   'your.smtp.server'
    -- ,             smtp_server_port =>              25
    -- ,             from_name =>                     'Email Address of Sender'
    -- ,             to_name =>                       'list of TO email addresses separated by commas (,)'
    -- ,             cc_name =>                       'list of CC email addresses separated by commas (,)'
    -- ,             bcc_name =>                      'list of BCC email addresses separated by commas (,)'
    -- ,             subject =>                       'Some brief Subject'
    -- ,             MESSAGE =>                       'Your message goes here. Can include HTML code.'
    -- ,             priority =>                      '1-5 1 being the highest priority and 3 normal priority'
    -- ,             filename =>                      'your.filename.txt or leave NULL'
    -- ,             binaryfile =>                    'your blob is passed here otherwise leave as EMPTY_BLOB()
    -- ,             DEBUG =>                         'Default is DBMS output otherwise pass a 1 to disable );
    -- END;
       PROCEDURE sendmail (
          smtp_server                         VARCHAR2
    ,     smtp_server_port                    PLS_INTEGER DEFAULT 25
    ,     from_name                           VARCHAR2
    ,     to_name                             VARCHAR2
    ,     cc_name                             VARCHAR2 DEFAULT NULL
    ,     bcc_name                            VARCHAR2 DEFAULT NULL
    ,     subject                             VARCHAR2
    ,     MESSAGE                             CLOB
    ,     priority                            PLS_INTEGER DEFAULT NULL
    ,     filename                            VARCHAR2 DEFAULT NULL
    ,     binaryfile                          BLOB DEFAULT EMPTY_BLOB ( )
    ,     DEBUG                               NUMBER DEFAULT 0 );
       v_parm_value                  VARCHAR2 ( 4000 );
       lbok                          BOOLEAN;
       v_smtp_server                 VARCHAR2 ( 50 );
       v_smtp_server_port            NUMBER := 25;
       crlf                          VARCHAR2 ( 10 ) := utl_tcp.crlf;
       conn                          utl_tcp.connection;
       p_debug_marker                PLS_INTEGER := 0;
       rc                            INTEGER;
       p_from_name                   VARCHAR2 ( 100 );
       p_to_name                     VARCHAR2 ( 4000 );
       p_cc_name                     VARCHAR2 ( 4000 );
       p_bcc_name                    VARCHAR2 ( 4000 );
       p_subject                     VARCHAR2 ( 150 );
       tx_timeout                    PLS_INTEGER := 240;
                                                      -- 240 Seconds (4 minutes);
       p_datestring                  VARCHAR2 ( 100 )
          :=    'Date: '
             || TO_CHAR ( SYSDATE, 'MM/DD/RR HH:MI AM' )
             || ' '
             || DBTIMEZONE
             || ' '
             || '(GMT'
             || DBTIMEZONE
             || ')';
       -- Customize the signature that will appear in the email's MIME header.
       -- Useful for versioning.
       mailer_id            CONSTANT VARCHAR2 ( 256 ) := 'Mailer by Oracle UTL_TCP';
       max_base64_line_width CONSTANT PLS_INTEGER := 76 / 4 * 3;
    END;
    CREATE OR REPLACE PACKAGE BODY mail_tools
    IS
       PROCEDURE print_output (
          p_message                  IN       VARCHAR2 )
       IS
       BEGIN
          dbms_output.put_line ( SUBSTR ( p_message
    ,                                     1
    ,                                     250 ));
          IF LENGTH ( p_message ) > 250
          THEN
             dbms_output.put_line ( SUBSTR ( p_message
    ,                                        251
    ,                                        500 ));
          END IF;
          IF LENGTH ( p_message ) > 500
          THEN
             dbms_output.put_line ( SUBSTR ( p_message
    ,                                        501
    ,                                        750 ));
          END IF;
          IF LENGTH ( p_message ) > 750
          THEN
             dbms_output.put_line ( SUBSTR ( p_message
    ,                                        751
    ,                                        1000 ));
          END IF;
       EXCEPTION
          WHEN OTHERS
          THEN
             NULL;               -- Ignore errors... protect buffer overflow's etc.
       END print_output;
       FUNCTION dump_flatfile (
          p_query                    IN       VARCHAR2
    ,     p_dir                      IN       VARCHAR2
    ,     p_filename                 IN       VARCHAR2
    ,     p_separator                IN       VARCHAR2
    ,     p_headers                  IN       BOOLEAN DEFAULT FALSE
    ,     p_trailing_separator       IN       BOOLEAN DEFAULT FALSE
    ,     p_max_linesize             IN       NUMBER DEFAULT 32000
    ,     p_mode                     IN       VARCHAR2 DEFAULT 'w' )
          RETURN NUMBER
       IS
          l_output                      utl_file.file_type;
          l_thecursor                   INTEGER DEFAULT dbms_sql.open_cursor;
          l_columnvalue                 VARCHAR2 ( 4000 );
          l_status                      INTEGER;
          l_colcnt                      NUMBER DEFAULT 0;
          l_cnt                         NUMBER DEFAULT 0;
          l_separator                   VARCHAR2 ( 10 ) DEFAULT '';
          l_line                        LONG;
          l_desctbl                     dbms_sql.desc_tab;
          v_sqlerrm                     VARCHAR2 ( 32000 );
          l_mode                        CHAR ( 1 ) := 'w';
       BEGIN
          IF p_mode NOT IN ( 'w', 'a' )
          THEN
             l_mode := 'w';
          ELSE
             l_mode := p_mode;
          END IF;
          l_output := utl_file.fopen ( p_dir
    ,                                  p_filename
    ,                                  l_mode
    ,                                  p_max_linesize );
          dbms_sql.parse ( l_thecursor
    ,                      p_query
    ,                      dbms_sql.native );
          dbms_sql.describe_columns ( l_thecursor
    ,                                 l_colcnt
    ,                                 l_desctbl );
          FOR i IN 1 .. l_colcnt
          LOOP
             dbms_sql.define_column ( l_thecursor
    ,                                 i
    ,                                 l_columnvalue
    ,                                 4000 );
             IF ( l_desctbl ( i ).col_type = 2 )                   /* number type */
             THEN
                l_desctbl ( i ).col_max_len := l_desctbl ( i ).col_precision + 2;
             ELSIF ( l_desctbl ( i ).col_type = 12 )                 /* date type */
             THEN
    /* length of my date format */
                l_desctbl ( i ).col_max_len := 20;
             ELSIF ( l_desctbl ( i ).col_type = 8 )                  /* LONG type */
             THEN
                l_desctbl ( i ).col_max_len := 2000;
             END IF;
             IF p_headers
             THEN
                utl_file.put ( l_output, l_separator || l_desctbl ( i ).col_name );
                l_separator := p_separator;
             END IF;
          END LOOP;
          IF p_trailing_separator
          THEN
             utl_file.put ( l_output, l_separator );
          END IF;
          IF p_headers
          THEN
             utl_file.new_line ( l_output );
          END IF;
          l_status := dbms_sql.EXECUTE ( l_thecursor );
          LOOP
             EXIT WHEN ( dbms_sql.fetch_rows ( l_thecursor ) <= 0 );
             l_line := NULL;
             l_separator := '';
             FOR i IN 1 .. l_colcnt
             LOOP
                dbms_sql.COLUMN_VALUE ( l_thecursor
    ,                                   i
    ,                                   l_columnvalue );
                IF NVL ( INSTR ( l_columnvalue, ',' ), 0 ) = 0
                THEN
                   NULL;
                ELSE
                   l_columnvalue := '"' || l_columnvalue || '"';
                END IF;
                utl_file.put ( l_output, l_separator || l_columnvalue );
                l_separator := p_separator;
             END LOOP;
             IF p_trailing_separator
             THEN
                utl_file.put ( l_output, l_separator );
             END IF;
             utl_file.new_line ( l_output );
             l_cnt := l_cnt + 1;
          END LOOP;
          dbms_sql.close_cursor ( l_thecursor );
          utl_file.fclose ( l_output );
          RETURN l_cnt;
       EXCEPTION
          WHEN NO_DATA_FOUND
          THEN
             dbms_output.put_line ( 'NO_DATA_FOUND' );
             utl_file.fclose ( l_output );
             RETURN l_cnt;
          WHEN utl_file.invalid_path
          THEN
             dbms_output.put_line ( 'UTL_FILE.INVALID_PATH' );
             utl_file.fclose ( l_output );
             RETURN l_cnt;
          WHEN utl_file.read_error
          THEN
             dbms_output.put_line ( 'UTL_FILE.READ_ERROR' );
             utl_file.fclose ( l_output );
             RETURN l_cnt;
          WHEN utl_file.write_error
          THEN
             dbms_output.put_line ( 'UTL_FILE.WRITE_ERROR' );
             utl_file.fclose ( l_output );
             RETURN l_cnt;
          WHEN utl_file.invalid_mode
          THEN
             dbms_output.put_line ( 'UTL_FILE.INVALID_MODE' );
             utl_file.fclose ( l_output );
             RETURN l_cnt;
          WHEN utl_file.invalid_filehandle
          THEN
             dbms_output.put_line ( 'UTL_FILE.INVALID_FILEHANDLE' );
             utl_file.fclose ( l_output );
             RETURN l_cnt;
          WHEN utl_file.invalid_operation
          THEN
             dbms_output.put_line ( 'UTL_FILE.INVALID_OPERATION' );
             utl_file.fclose ( l_output );
             RETURN l_cnt;
          WHEN utl_file.internal_error
          THEN
             dbms_output.put_line ( 'UTL_FILE.INTERNAL_ERROR' );
             utl_file.fclose ( l_output );
             RETURN l_cnt;
          WHEN utl_file.invalid_maxlinesize
          THEN
             dbms_output.put_line ( 'UTL_FILE.INVALID_MAXLINESIZE' );
             utl_file.fclose ( l_output );
             RETURN l_cnt;
          WHEN VALUE_ERROR
          THEN
             dbms_output.put_line ( 'UTL_FILE.VALUE_ERROR' );
             utl_file.fclose ( l_output );
             RETURN l_cnt;
          WHEN OTHERS
          THEN
             hum_do.default_exception ( 'ERROR in dump_csv : ' );
             utl_file.fclose ( l_output );
             RETURN l_cnt;
       END dump_flatfile;
       -- 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_mail_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;
       FUNCTION smtp_command (
          command                    IN       VARCHAR2
    ,     ok                         IN       VARCHAR2 DEFAULT '250'
    ,     code                       OUT      VARCHAR2
    ,     DEBUG                               NUMBER DEFAULT 0 )
          RETURN BOOLEAN
       IS
          response                      VARCHAR2 ( 3 );
          p_output_message              VARCHAR2 ( 255 );
          len                           PLS_INTEGER;
          PRAGMA AUTONOMOUS_TRANSACTION;
       BEGIN
          len := utl_tcp.write_line ( conn, command );
          p_output_message := SUBSTR ( utl_tcp.get_line ( conn, TRUE )
    ,                                  1
    ,                                  255 );
          response := SUBSTR ( p_output_message
    ,                          1
    ,                          3 );
          p_output_message :=
                             SUBSTR ( command || ' - ' || p_output_message
    ,                                 1
    ,                                 255 );
          IF DEBUG = 1
          THEN                                                          -- No Output
             NULL;
          ELSE                                          -- Then DBMS_OUTPUT messages
             print_output ( p_output_message );
          END IF;
          IF ( response <> ok )
          THEN
             code := response;
             RETURN FALSE;
          ELSE
             code := response;
             RETURN TRUE;
          END IF;
       EXCEPTION
          WHEN OTHERS
          THEN
             p_output_message := SQLCODE || ' - ' || SQLERRM;
             code := p_output_message;
             RETURN FALSE;
       END smtp_command;
       FUNCTION query_server (
          smtp_server                         VARCHAR2
    ,     smtp_server_port                    PLS_INTEGER DEFAULT 25
    ,     DEBUG                               NUMBER DEFAULT 0 )
          RETURN BOOLEAN
       IS
          p_output_message              VARCHAR2 ( 255 );
          PRAGMA AUTONOMOUS_TRANSACTION;
          err_noop                      EXCEPTION;    -- SMTP code 250 not received
          err_server_reject             EXCEPTION;
       -- SMTP code 421 means rejected
       BEGIN
          v_smtp_server := smtp_server;
          v_smtp_server_port := smtp_server_port;
    -- Open the SMTP connection ...
          conn :=
             utl_tcp.open_connection ( remote_host =>                   v_smtp_server
    ,                                  remote_port =>                   v_smtp_server_port
    ,                                  tx_timeout =>                    tx_timeout );
          ----- OPEN SMTP PORT CONNECTION
          rc := utl_tcp.write_line ( conn, 'HELO ' || v_smtp_server );
                -- This will return a 250 OK response if your connection is valid
    -- Initial handshaking ...
          ----- PERFORMS HANDSHAKING WITH SMTP SERVER
          p_output_message := utl_tcp.get_line ( conn, TRUE );
          IF DEBUG = 1
          THEN                                                          -- No Output
             NULL;
          ELSE                                          -- Then DBMS_OUTPUT messages
             print_output ( p_output_message );
          END IF;
          IF SUBSTR ( p_output_message
    ,                 1
    ,                 3 ) = '421'
          THEN
             RAISE err_server_reject;
          END IF;
          -- NOOP THE SERVER
          rc := utl_tcp.write_line ( conn, 'NOOP' );
                -- This will return a 250 OK response if your connection is valid
    -- Initial handshaking ...
          ----- PERFORMS NOOP WITH SMTP SERVER
          p_output_message := utl_tcp.get_line ( conn, TRUE );
          IF DEBUG = 1
          THEN                                                          -- No Output
             NULL;
          ELSE                                          -- Then DBMS_OUTPUT messages
             print_output ( p_output_message );
          END IF;
          IF SUBSTR ( p_output_message
    ,                 1
    ,                 3 ) <> '250'
          THEN
             RAISE err_noop;
          END IF;
          rc := utl_tcp.write_line ( conn, 'QUIT' );
          ----- ENDS EMAIL TRANSACTION
          BEGIN
             FOR i_idx IN 1 .. 100
             LOOP
                p_output_message := utl_tcp.get_line ( conn, TRUE );
                IF DEBUG = 1
                THEN                                                   -- No Output
                   NULL;
                ELSE                                    -- Then DBMS_OUTPUT messages
                   print_output ( p_output_message );
                END IF;
             END LOOP;
          EXCEPTION
             WHEN OTHERS
             THEN
                IF DEBUG = 1
                THEN                                                   -- No Output
                   NULL;
                ELSE                                    -- Then DBMS_OUTPUT messages
                   print_output ( p_output_message );
                END IF;
          END;
          utl_tcp.close_connection ( conn );        ----- CLOSE SMTP PORT CONNECTION
          RETURN TRUE;
       EXCEPTION
          WHEN err_server_reject
          THEN
             print_output (    'ERROR -'
                            || ' Server Rejected Connection ::'
                            || ' SERVER_MSG := '
                            || p_output_message );
             RETURN FALSE;
          WHEN err_noop
          THEN
             print_output (    'ERROR -'
                            || ' NOOP Check Failed ::'
                            || ' SERVER_MSG := '
                            || p_output_message );
             utl_tcp.close_connection ( conn );     ----- CLOSE SMTP PORT CONNECTION
             RETURN FALSE;
       END query_server;
       FUNCTION get_local_binary_data (
          p_dir                      IN       VARCHAR2
    ,     p_file                     IN       VARCHAR2 )
          RETURN BLOB
       IS
          l_bfile                       BFILE;
          l_data                        BLOB;
          l_dbdir                       VARCHAR2 ( 100 ) := p_dir;
       BEGIN
          dbms_lob.createtemporary ( lob_loc =>                       l_data
    ,                                CACHE =>                         TRUE
    ,                                dur =>                           dbms_lob.CALL );
          l_bfile := BFILENAME ( l_dbdir, p_file );
          dbms_lob.fileopen ( l_bfile, dbms_lob.file_readonly );
          dbms_lob.loadfromfile ( l_data
    ,                             l_bfile
    ,                             dbms_lob.getlength ( l_bfile ));
          dbms_lob.fileclose ( l_bfile );
          RETURN l_data;
       EXCEPTION
          WHEN OTHERS
          THEN
             print_output (    'Error during GET_LOCAL_BINARY_DATA :: '
                            || SQLCODE
                            || ' - '
                            || SQLERRM );
             dbms_lob.fileclose ( l_bfile );
             RAISE;
       END get_local_binary_data;
       PROCEDURE attach_base64 (
          conn                       IN OUT NOCOPY utl_tcp.connection
    ,     DATA                       IN       BLOB )
       IS
          i                             PLS_INTEGER;
          len                           PLS_INTEGER;
          l_result                      PLS_INTEGER;
          l_buffer                      RAW ( 32767 );
          l_pos                         INTEGER := 1;
          l_blob_len                    INTEGER;
          l_amount                      BINARY_INTEGER := 32767;
          req                           utl_http.req;
          resp                          utl_http.resp;
          pdata                         RAW ( 200 );
       BEGIN
          -- Split the Base64-encoded attachment into multiple lines
          -- 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 MAX_BASE64_LINE_WIDTH
          -- (76 / 4 * 3 = 57) is the maximum length (in bytes) of each chunk
          -- of data before encoding.
          l_blob_len := dbms_lob.getlength ( DATA );
          WHILE l_pos < l_blob_len
          LOOP
             l_amount := max_base64_line_width;
             dbms_lob.READ ( DATA
    ,                        l_amount
    ,                        l_pos
    ,                        l_buffer );
             rc := utl_tcp.write_raw ( conn, utl_encode.base64_encode ( l_buffer ));
             utl_tcp.FLUSH ( conn );
             l_pos := l_pos + max_base64_line_width;
             rc := utl_tcp.write_line ( conn, crlf );
          END LOOP;
       END attach_base64;
       PROCEDURE sendmail (
          smtp_server                         VARCHAR2
    ,     smtp_server_port                    PLS_INTEGER DEFAULT 25
    ,     from_name                           VARCHAR2
    ,     to_name                             VARCHAR2
    ,     cc_name                             VARCHAR2 DEFAULT NULL
    ,     bcc_name                            VARCHAR2 DEFAULT NULL
    ,     subject                             VARCHAR2
    ,     MESSAGE                             CLOB
    ,     priority                            PLS_INTEGER DEFAULT NULL
    ,     filename                            VARCHAR2 DEFAULT NULL
    ,     binaryfile                          BLOB DEFAULT EMPTY_BLOB ( )
    ,     DEBUG                               NUMBER DEFAULT 0 )
       IS
          pos                           PLS_INTEGER := 1;
          bytes_o_data         CONSTANT PLS_INTEGER := 32767;
          offset                        PLS_INTEGER := bytes_o_data;
          msg_length           CONSTANT PLS_INTEGER
                                                  := dbms_lob.getlength ( MESSAGE );
          v_line                        VARCHAR2 ( 32767 );
          i                             BINARY_INTEGER;
          v_slash_pos                   NUMBER;
          my_recipients                 VARCHAR2 ( 32767 );
          p_recipient_count             PLS_INTEGER := 0;
          p_output_message              VARCHAR2 ( 2000 );
          PRAGMA AUTONOMOUS_TRANSACTION;
          err_server_reject             EXCEPTION;
          -- SMTP code 421 means rejected
          err_message_send              EXCEPTION;         -- SMTP code must be 250
          err_end_of_input              EXCEPTION;
       -- Used to signify last line of input retrieved
          l_result                      PLS_INTEGER;
          l_buffer_b                    RAW ( 32767 );
          l_amount                      BINARY_INTEGER := 32767;
          l_pos                         INTEGER := 1;
          l_blob_len                    INTEGER;
          l_blob                        BLOB;
          g_debug                       BOOLEAN := TRUE;
          i_base64                      PLS_INTEGER;
          len_base64                    PLS_INTEGER;
       BEGIN
          v_smtp_server := smtp_server;
          v_smtp_server_port := smtp_server_port;
          l_blob := binaryfile;
    -- Open the SMTP connection ...
          conn :=
             utl_tcp.open_connection ( remote_host =>                   v_smtp_server
    ,                                  remote_port =>                   v_smtp_server_port
    ,                                  tx_timeout =>                    tx_timeout );
          ----- OPEN SMTP PORT CONNECTION
          rc := utl_tcp.write_line ( conn, 'HELO ' || v_smtp_server );
    -- Initial handshaking ...
          ----- PERFORMS HANDSHAKING WITH SMTP SERVER
          p_output_message := utl_tcp.get_line ( conn, TRUE );
          IF DEBUG = 1
          THEN                                                          -- No Output
             NULL;
          ELSE                                          -- Then DBMS_OUTPUT messages
             print_output ( p_output_message );
          END IF;
          IF SUBSTR ( p_output_message
    ,                 1
    ,                 3 ) = '421'
          THEN
             RAISE err_server_reject;
          ELSE
    --      DBMS_OUTPUT.put_line (UTL_TCP.get_line (conn, TRUE));
             rc := utl_tcp.write_line ( conn, 'MAIL FROM: ' || from_name );
             ----- MBOX SENDING THE EMAIL
             p_output_message := utl_tcp.get_line ( conn, TRUE );
             IF DEBUG = 1
             THEN                                                      -- No Output
                NULL;
             ELSE                                       -- Then DBMS_OUTPUT messages
                print_output ( p_output_message );
             END IF;
    --      DBMS_OUTPUT.put_line (UTL_TCP.get_line (conn, TRUE));
             --      rc := UTL_TCP.write_line (conn, 'RCPT TO: ' || to_name);
             -- Specify recipient(s) of the email.
             my_recipients := to_name;
             WHILE ( my_recipients IS NOT NULL )
             LOOP
                BEGIN
                   rc :=
                      utl_tcp.write_line ( conn
    ,                                         'RCPT TO: '
                                           || get_mail_address ( my_recipients ));
                   p_recipient_count := p_recipient_count + 1;
                END;
             END LOOP;
    --         DBMS_OUTPUT.put_line ('RCPT TO: COUNT ' || p_recipient_count);
             ----- MBOX RECV THE EMAIL
             p_output_message := utl_tcp.get_line ( conn, TRUE );
             IF DEBUG = 1
             THEN                                                       -- No Output
                NULL;
             ELSE                                       -- Then DBMS_OUTPUT messages
                print_output ( p_output_message );
             END IF;
    --      DBMS_OUTPUT.put_line (UTL_TCP.get_line (conn, TRUE));
             --      rc := UTL_TCP.write_line (conn, 'RCPT TO: ' || cc_name);
             -- Specify cc recipient(s) of the email.
             my_recipients := cc_name;
             WHILE ( my_recipients IS NOT NULL )
             LOOP
                BEGIN
                   rc :=
                      utl_tcp.write_line ( conn
    ,                                         'RCPT TO: '
                                           || get_mail_address ( my_recipients ));
                   p_recipient_count := p_recipient_count + 1;
                END;
             END LOOP;
    --         DBMS_OUTPUT.put_line ('RCPT TO: COUNT ' || p_recipient_count);
             ----- MBOX RECV THE EMAIL
             p_output_message := utl_tcp.get_line ( conn, TRUE );
             IF DEBUG = 1
             THEN                                                       -- No Output
                NULL;
             ELSE                                       -- Then DBMS_OUTPUT messages
                print_output ( p_output_message );
             END IF;
    --      DBMS_OUTPUT.put_line (UTL_TCP.get_line (conn, TRUE));
             --      rc := UTL_TCP.write_line (conn, 'RCPT TO: ' || bcc_name);
             -- Specify bcc recipient(s) of the email.
             my_recipients := bcc_name;
             WHILE ( my_recipients IS NOT NULL )
             LOOP
                BEGIN
                   rc :=
                      utl_tcp.write_line ( conn
    ,                                         'RCPT TO: '
                                           || get_mail_address ( my_recipients ));
                   p_recipient_count := p_recipient_count + 1;
                END;
             END LOOP;
    --         DBMS_OUTPUT.put_line ('RCPT TO: COUNT ' || p_recipient_count);
             ----- MBOX RECV THE EMAIL
             p_output_message := utl_tcp.get_line ( conn, TRUE );
             IF DEBUG = 1
             THEN                                                       -- No Output
                NULL;
             ELSE                                       -- Then DBMS_OUTPUT messages
                print_output ( p_output_message );
             END IF;
    --      DBMS_OUTPUT.put_line (UTL_TCP.get_line (conn, TRUE));
             rc := utl_tcp.write_line ( conn, 'DATA' );
             ----- EMAIL MSG BODY START
             p_output_message := utl_tcp.get_line ( conn, TRUE );
             IF DEBUG = 1
             THEN                                                       -- No Output
                NULL;
             ELSE                                       -- Then DBMS_OUTPUT messages
                print_output ( p_output_message );
             END IF;
    --      DBMS_OUTPUT.put_line (UTL_TCP.get_line (conn, TRUE));
    -- build the start of the mail message ...
             rc := utl_tcp.write_line ( conn, p_datestring );
             rc := utl_tcp.write_line ( conn, 'From: ' || from_name );
             rc := utl_tcp.write_line ( conn, 'Subject: ' || subject );
             rc := utl_tcp.write_line ( conn, 'To: ' || to_name );
             IF cc_name IS NOT NULL
             THEN
                rc := utl_tcp.write_line ( conn, 'Cc: ' || cc_name );
             END IF;
             IF bcc_name IS NOT NULL
             THEN
                rc := utl_tcp.write_line ( conn, 'Bcc: ' || bcc_name );
             END IF;
             rc := utl_tcp.write_line ( conn, 'Mime-Version: 1.0' );
                  -- Set priority:
             --   High      Normal       Low
             --   1     2     3     4     5
             IF ( priority IS NOT NULL )
             THEN
                rc := utl_tcp.write_line ( conn, 'X-Priority: ' || priority );
             END IF;
             rc := utl_tcp.write_line ( conn, 'X-Mailer: ' || mailer_id );
             rc :=
                utl_tcp.write_line
                   ( conn
    ,                'Content-Type: multipart/mixed; boundary="=_mixed 0052287A85256E75_="' );
             rc := utl_tcp.write_line ( conn, '' );
             rc :=
                utl_tcp.write_line
                   ( conn
    ,                'This is a Mime message, which your current mail reader may not' );
             rc :=
                utl_tcp.write_line
                   ( conn
    ,                'understand. Parts of the message will appear as text. If the remainder' );
             rc :=
                utl_tcp.write_line
                   ( conn
    ,                'appears as random characters in the message body, instead of as' );
             rc :=
                utl_tcp.write_line
                   ( conn
    ,                'attachments, then you''ll have to extract these parts and decode them' );
             rc := utl_tcp.write_line ( conn, 'manually.' );
             rc := utl_tcp.write_line ( conn, '' );
             rc := utl_tcp.write_line ( conn, '--=_mixed 0052287A85256E75_=' );
             rc :=
                utl_tcp.write_line ( conn
    ,                                'Content-Type: text/html; charset=8859-1' );
             rc := utl_tcp.write_line ( conn, '' );
             rc := utl_tcp.write_line ( conn, '<html>' );
             rc := utl_tcp.write_line ( conn, '<head>' );
             rc :=
                utl_tcp.write_line
                   ( conn
    ,                '<meta http-equiv="Content-Type" content="text/html;charset=8859-1">' );
             rc := utl_tcp.write_line ( conn, '<title>' );
             rc := utl_tcp.write_line ( conn, subject );
             rc := utl_tcp.write_line ( conn, '</title>' );
             rc := utl_tcp.write_line ( conn, '</head>' );
             rc := utl_tcp.write_line ( conn, '<body>' );
             WHILE pos < msg_length
             LOOP
                rc :=
                   utl_tcp.write_line ( conn
    ,                                   dbms_lob.SUBSTR ( MESSAGE
    ,                                                     offset
    ,                                                     pos ));
                pos := pos + offset;
                offset := LEAST ( bytes_o_data, msg_length - offset );
             END LOOP;
             rc := utl_tcp.write_line ( conn, '<BR><BR>' );
             rc := utl_tcp.write_line ( conn, '</body></html>' );
             rc := utl_tcp.write_line ( conn, '' );
             rc := utl_tcp.write_line ( conn, crlf );
    -- Append the file BLOB  ...
                -- If the filename has been supplied ... it will fail if the BLOB is empty
             IF filename IS NOT NULL
             THEN
                BEGIN
                   -- generate the MIME boundary line ...
                   rc :=
                        utl_tcp.write_line ( conn, '--=_mixed 0052287A85256E75_=' );
                   rc :=
                      utl_tcp.write_line
                              ( conn
    ,                              'Content-Type: application/octet-stream; name="'
                                || filename
                                || '"' );
                   rc :=
                      utl_tcp.write_line
                                  ( conn
    ,                                  'Content-Disposition: attachment; filename="'
                                    || filename
                                    || '"' );
                   rc :=
                      utl_tcp.write_line ( conn
    ,                                      'Content-Transfer-Encoding: base64' );
                   rc := utl_tcp.write_line ( conn, '' );
                   rc := utl_tcp.write_line ( conn, '' );
                   -- and append the file contents to the end of the message ...
                   -- Go get the file and the loop through blob and attach data
                   -- and append the file contents to the end of the message ...
                   attach_base64 ( conn =>                          conn
    ,                              DATA =>                          l_blob );
                EXCEPTION
                   WHEN OTHERS
                   THEN
                      p_output_message :=
                            'Error in attaching file '
                         || filename
                         || ' :: '
                         || SQLCODE
                         || ' - '
                         || SQLERRM;
                      IF DEBUG = 1
                      THEN                                              -- No Output
                         NULL;
                      ELSE                              -- Then DBMS_OUTPUT messages
                         print_output ( p_output_message );
                      END IF;
                      RAISE err_message_send;
                END;
             END IF;
             rc := utl_tcp.write_line ( conn, '' );
             -- append the final boundary line ...
             rc := utl_tcp.write_line ( conn, '' );
             rc := utl_tcp.write_line ( conn, '--=_mixed 0052287A85256E75_=--' );
             rc := utl_tcp.write_line ( conn, '' );
             -- and close the SMTP connection  ...
             rc := utl_tcp.write_line ( conn, '.' );
             ----- EMAIL MESSAGE BODY END
             p_output_message := utl_tcp.get_line ( conn, TRUE );
             IF DEBUG = 1
             THEN                                                       -- No Output
                NULL;
             ELSE                                       -- Then DBMS_OUTPUT messages
                print_output ( p_output_message );
             END IF;
    --      DBMS_OUTPUT.put_line (UTL_TCP.get_line (conn, TRUE));
             rc := utl_tcp.write_line ( conn, 'QUIT' );
             ----- ENDS EMAIL TRANSACTION
             p_output_message := utl_tcp.get_line ( conn, TRUE );
             -- Capture '.' Message sent dialog
             IF DEBUG = 1
             THEN                                                       -- No Output
                NULL;
             ELSE                                       -- Then DBMS_OUTPUT messages
                print_output ( p_output_message );
             END IF;
             BEGIN
                FOR i_idx IN 1 .. 100
                LOOP
                   p_output_message := utl_tcp.get_line ( conn, TRUE );
                   IF DEBUG = 1
                   THEN                                                -- No Output
                      NULL;
                   ELSE                                 -- Then DBMS_OUTPUT messages
                      print_output ( p_output_message );
                   END IF;
                END LOOP;
             EXCEPTION
                WHEN OTHERS
                THEN
                   IF DEBUG = 1
                   THEN                                                -- No Output
                      NULL;
                   ELSE                                 -- Then DBMS_OUTPUT messages
                      print_output ( p_output_message );
                   END IF;
             END;
          END IF;                                               -- err_server_reject
          utl_tcp.close_connection ( conn );        ----- CLOSE SMTP PORT CONNECTION
       EXCEPTION
          WHEN err_message_send
          THEN
             print_output (    CHR ( 10 )
                            || CHR ( 10 )
                            || 'ERROR -'
                            || ' Message was not submitted for delivery' );
             print_output ( ' [FROM_NAME := ' || from_name || '] ' );
             print_output ( ' [TO_NAME := ' || to_name || '] ' );
             print_output ( ' [CC_NAME := ' || cc_name || '] ' );
             print_output ( ' [BCC_NAME := ' || bcc_name || '] ' );
             print_output ( ' [SUBJECT := ' || subject || '] ' );
             print_output ( ' SERVER_MSG := ' || p_output_message );
             utl_tcp.close_connection ( conn );     ----- CLOSE SMTP PORT CONNECTION
          WHEN err_server_reject
          THEN
             print_output (    CHR ( 10 )
                            || CHR ( 10 )
                            || 'ERROR -'
                            || ' Server Rejected Email' );
             print_output ( ' [FROM_NAME := ' || from_name || '] ' );
             print_output ( ' [TO_NAME := ' || to_name || '] ' );
             print_output ( ' [CC_NAME := ' || cc_name || '] ' );
             print_output ( ' [BCC_NAME := ' || bcc_name || '] ' );
             print_output ( ' [SUBJECT := ' || subject || '] ' );
             print_output ( ' SERVER_MSG := ' || p_output_message );
          WHEN OTHERS
          THEN
             print_output (    CHR ( 10 )
                            || CHR ( 10 )
                            || 'ERROR :: '
                            || SQLCODE
                            || ' - '
                            || SQLERRM );
             print_output ( ' [FROM_NAME := ' || from_name || '] ' );
             print_output ( ' [TO_NAME := ' || to_name || '] ' );
             print_output ( ' [CC_NAME := ' || cc_name || '] ' );
             print_output ( ' [BCC_NAME := ' || bcc_name || '] ' );
             print_output ( ' [SUBJECT := ' || subject || '] ' );
             print_output ( ' SERVER_MSG := ' || p_output_message );
       END sendmail;
    END;
    /

    Perhaps your new SMTP server requires a more secure form of authentication than AUTH LOGIN. If you telnet to this new SMTP server on port 25 you should be issue the HELO or EHLO command to find out what AUTH mechanisms the server supports. You could then alter your code to use one of the supported authentication mechanisms.

  • A new Encore user's experience.

    Being as this is a louge this might be a place to share.
    First, I am not a pro, but I have been using Premiere since 4.2 to produce simple teaching videos and over time have gotten to where I have done more fun stuff and even a couple of events, for money even.  Until recently I created my DVDs using Sony DVD Architech.
    So all week I've been editing video from a race held near here recently (motorsports, 24 Hours of LeMons) where I attended with a team with the idea of getting photos and video and putting together something the team and friends would enjoy.  I got some good in-car video, and some not so good, but that's another matter.
    For this project I decided to finally try using Encore to create the DVD.  The Sony software didn't do Blu-Ray and I wanted to try that, too.  So I start up Encore and when it finally loaded I started a project in the usual Adobe style then was presented with a screen I simply could not figure out.  I poked around trying to figure out what the basic procedure was and found the "import" function, tried to import and mgep file, and I got my first blue screen ever on this system.
    Rebooted, and restarted Encore, I explored more on my own.  I can usually figure out these things on my own.  I explored the menus and buttons, and figured out that an asset was probably anything I wanted to put on the DVD.  Other than that I was pretty much stuck.  I imported another mpeg file and that worked, but I finally gave up and decided to try "Help".  That took me to the Adobe site, and that to the Lynda tutorials, which were just what I needed.  I went through them one-by-one and they answered most of my questions.  They were excellent.  Quick, clear, and just the right amount of detail for a tutorial.  Adobe did good with that one.
    With Lynda's help I was off and running.  I figured out how to create menu templates by examining the ones that came with Encore and I figured out how to change the order and other settings for each button.  Everything was going smoothly now.  I had a project that had a menu and three videos.  The preview feature was also working great.  But, the highlight I used for my buttons is a green dot that has an inner shadow.  In preview I only get a green dot.  No shadow.  Later on the DVD itself, same thing.  I later learend by reading in these forums that that is the fault of the DVD player.
    I still had room for one more button, and I still had lots of photos I had not used, so I tried the slide show feature.  It looked like it would a good job just showing photos, and for this project I thought it would be a nice little extra.  I know that some people here consider it to be a comsumer gimick and just seeing it in Encore made me think the same thing, as if Adobe wanted to be able to match the features of (much) lesser DVD authoring programs.  No matter.  I'd also learn, by experience that this feature still needs a little work.  Again, I am not a pro, so if I notice something that needs fixing it must really scream out at you guys and gals.
    It was pretty easy to import my photos and add them to the slide show, but I soon learned that 99 photos is the max for a slide show.  I suppose that is OK.  Next, I learned that the shortest time I could display a slide is about 1.2 seconds.  I was hpoing to be able to run through some of my photos quickly to simuate a stop-action sequence for those times when I just held the shutter release button and snapped away at the action, such as a car spinning off into the dirt.  It could be that this limit is due to the cross-fade transitions I had set as the slide show's default transition.  I'll try it again later without transitions to see what happens.
    Adding and removing slides turned out to be a real pain.  When addidng slides in mass I'd get an error saying there was something wrong with a slide.  I forget what the other errors were, but I got a lot of them.  They were probably related to the number of slides I was placing in the timeline, over 99 total.  But besides the errors, Encore really slowed down.  It took maybe 10-15 minutes for it to get back to normal, or just about how long it took me to give up and go off and fold laundry.  So then I tried to delete some slides and that took for ever, especially if the slide was near the beginning of the show.  I figure Encode must be reprocessing the whole show somehwow.  But after these problems something seemd to be wrong with Encore.  It was slow when doing anything.  I closed it and started it up again.  It was all better again.
    In previews the slide show looked good, but I realized that I needed to resize the photos.  I did this in Photoshop for a handful then came back to Encore, expecting it to update itself, seeing as assets like these are external to the Encore project itself, but that didn't happen.  If I edited a video and came back to Premiere it would re-import the video.  Apparently this doesn't happen in the slide show.  I deleted the slide show and started again.  At least it is easy to set up new slide shows, except as noted above.
    The do-over worked.  The slide show looked good.
    I burned a DVD and the results were excellent, except for, again, the slide show.  The show ran OK, but at the end of each transition there was a little flicker, more like a contrast glitch.  Annoying, and it has to be fixed or else the slide show feature will be useless, even for me, except for personal use.
    Other than that, all was good.  I edited video and Encore reimported it and the burn was successful and it looked great, well, on my analog TV.  I still don't have digital as I canceld cable and quit watching TV nearly 2 years ago.  But it was working, minor changes were easily handled, etc.
    I then tried the Flash feature, and it worked well, except that the video frame is not centered (too far to the right).  The HTML code was simple enough.  The video plays in a table whose width is 99% of the screen the cell justification is centered.  I'm sure I could deal with that in my own pages.  But, a bigger problem, again involving the slide show.  The VCR controls would pop up at the start, or end, of each slide, and then would disappear again on its own.  Again, the slide show is a nice feature but I can't use it if the controls are going to be going up and down throughout the show.
    I also exported an image and will be trying that out later.  Being able to create an image for the DVD is nice.  It means I won't have to use Encode for future burns, and I might have trouble keeping up with the 80 GB of files I have in this project.
    Mike

    Thanks for reporting.
    I'm one of those folk, who shies away from SlideShow in En, choosing to do that in PrPro and then Exporting a DV-AVI.
    Though this is not a "technical" forum, I'll risk Jeff & Neil's wrath and throw out one comment. If your still images were not resized to your Project's Frame Size, say 720 x 480, PAR = 1.22 (for NTSC 16:9 in this example), you are asking the program to downsize all of your 99 stills. That WILL slow things to a crawl. Also, I feel that resizing in Photoshop, rather than En, or PrPro, will give you better results. This is a time, where bigger is not better. If you redo, or do a similar Project, explore resizing the stills in PS first, and then Importing those. This ARTICLE might give you some tips on automating the resizing, prior to Import.
    OK, enough of that technical drivel. Thanks again for sharing!
    Hunt

  • Sender Mail Adapter able to retrieve HTML emails?

    Hi there,
    I stamped over an issue that look like an adapter limitation, would like to hear you opinions.
    We´re using a POP3 account configured in a Sender Mail Communication Channel with XIPAYLOAD, with this attempts:
    - with or without the Mail Package;
    - any type of encoding;
    - must keep attachments.
    In all of this options always the retrieved email from the POP Server comes in TEXT format.
    Does the Mail Adapter support HTML emails?
    Does the Mail Adapter support mixed/alternative Content-Type?
    >Current version: SAP PI 7.0 SP14
    >Mail Server: Lotus Domino 7.0.x
    Regards,
    Marlo Simon.

    Ok,
    I´m using the Sender Mail Scenario.
    I tried the MessageTransformBean (Transform.ContentType) to force the Content-type to text/html and it made no difference.
    Is there any Advanced parameter that would help? No docummentation from SAP on those ones.
    I want to keep the original email body, but looks like the adapter only read plain text.
    Rgds,
    Marlo Simon.
    Edited by: Marlo Simon on Feb 5, 2010 2:23 PM

  • Problem with package that create mail with PDF attachment

    Hola,
    I've this problem when I use the Oracle Package called "demo_mail",
    that I have download from this forum en september.
    The code of the Package, I post bottom, now I
    write the records of the Package,
    that I believe is the core of the problem:
    demo_mail.begin_attachment( conn => conn,
    mime_type => 'application/pdf',
    inline => TRUE, filename => ''|| VC_NOMEFILE ||'',
    transfer_enc => 'base64');
    The mime_type is correct?
    Why when I open the attachment of the mail, it say me that file type
    is not correct or the file has been damneged? I need help!
    Thank's
    *********************************************************The steps that I've done:
    1. PACKAGE demo_mail
    2. PACKAGE BODY demo_mail
    3. procedure P_SPEDMAILSERVATTA (that call package) this
    Cannot write the code, because this the result. :(((
    thank's
    CREATE OR REPLACE PACKAGE demo_mail IS
    -- Customize the SMTP host, port and your domain name below.
    smtp_host VARCHAR2(256) := 'XXX.YYYY.IT';
    smtp_port PLS_INTEGER := 25;
    smtp_domain VARCHAR2(256) := 'YYYY.it';
    -- 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;
    -- 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',
                        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 IS
    -- 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);
    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_data(conn, 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
         -- After upgrade to Oracle 9i, replace demo_base64.encode with the
         -- native utl_encode.base64_encode for better performance:
         -- utl_smtp.write_raw_data(conn,
    -- utl_encode.base64_encode(utl_raw.substr(data, i,
         -- MAX_BASE64_LINE_WIDTH)));
         utl_smtp.write_raw_data(conn,
    utl_encode.base64_encode(utl_raw.substr(data, i,
         MAX_BASE64_LINE_WIDTH)));
    ELSE
         -- After upgrade to Oracle 9i, replace demo_base64.encode with the
         -- native utl_encode.base64_encode for better performance:
         -- utl_smtp.write_raw_data(conn,
         -- utl_encode.base64_encode(utl_raw.substr(data, i)));
         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',
                        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;
    PROMPT     **********************************************************
    PROMPT     CREAZIONE PROCEDURA P_SPEDMAILSERVATTA
    PROMPT     **********************************************************
    create or replace procedure P_SPEDMAILSERVATTA( VC_DESCDENOAZIE IN VARCHAR2,
                                  VC_DESCINDIEMAI IN VARCHAR2,
                                  VC_NUMEBOLL     IN VARCHAR2,
                                  VC_PATHFILE     IN VARCHAR2,
                                  VC_NOMEFILE     IN VARCHAR2,
                                  VC_DESCINDIEMAIMITT IN VARCHAR2)
    IS
    conn utl_smtp.connection;
    req utl_http.req;
    resp utl_http.resp;
    data RAW(200);
    BEGIN
    conn := demo_mail.begin_mail(
    sender => 'SIAG srl <'|| VC_DESCINDIEMAIMITT ||'>',
    recipients => ''|| VC_DESCDENOAZIE ||' '||'<'|| VC_DESCINDIEMAI ||'>'||'',
    subject => 'Invio Bollettino n.'|| VC_NUMEBOLL ||'',
    mime_type => demo_mail.MULTIPART_MIME_TYPE);
    demo_mail.attach_text(
    conn => conn,
    data => 'Spett.le <b>'|| VC_DESCDENOAZIE ||'</b> <br> in allegato Le invio il Bollettino n. '|| VC_NUMEBOLL ||'.<br> <br> Distinti Saluti <br><br> <hr align="left" width="20%"> ',
    mime_type => 'text/html');
    demo_mail.begin_attachment(
    conn => conn,
    mime_type => 'application/pdf',
    inline => TRUE,
    filename => ''|| VC_NOMEFILE ||'',
    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.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('http://localhost/'|| VC_PATHFILE ||'/'|| VC_NOMEFILE ||'');
    resp := utl_http.get_response(req);
    BEGIN
    LOOP
    utl_http.read_raw(resp, data, demo_mail.MAX_BASE64_LINE_WIDTH);
    demo_mail.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.end_attachment( conn => conn );
    demo_mail.end_mail( conn => conn );
    END;
    Message was edited by:
    mosquito70
    Message was edited by:
    mosquito70

    Hola, I've this problem when I use the Oracle Package called "demo_mail",
    that I have download from this forum en september.
    The code of the Package, I post bottom, now I
    write the records of the Package,
    that I believe is the core of the problem:
    demo_mail.begin_attachment( conn => conn,
    mime_type => 'application/pdf',
    inline => TRUE, filename => ''|| VC_NOMEFILE ||'',
    transfer_enc => 'base64');
    The mime_type is correct?
    Why when I open the attachment of the mail, it say me that file type
    is not correct or the file has been damneged? I need help!
    Thank's
    The steps that I've done:
    1. PACKAGE demo_mail
    2. PACKAGE BODY demo_mail
    3. procedure P_SPEDMAILSERVATTA (that call package)
    I cannot post the code :((

Maybe you are looking for

  • USPS shipping labels refund

    Hi everyone,      See if any of you can ans my question which has been bothering me for 2 week, very very annoying ...... 1) I created an USPS priority international label through paypal, sent the parcel, and it was stucked in LA, then return back to

  • Main window ptr. from separate NIB file

    Hi All, This sounds like the simple kind of job a programmer would do everyday, but I haven't been able to figure it out yet. My NSObject app has the usual main window and MainMenu.nib file, and my user-defaults are kept in an NSWindowController subc

  • Image in fluid layout

    Hi! If I have a small image in a fluid layout column which is the best practice for having the image's width adjust to the column width while still remaining proportional with its height? Thanks! kt

  • Adobe Reader 7.05 のインストール出来ない

    Adobe Reader 7.05 のインストール出来ません.OSはWindows2000 SP-4です. インストールの途中で."選択した機能は現在使用できないネットワークリソースにあります.(中略)Adobe Reader 6.0 - Japanese.msiを含むフォルダーに対する代替パスを〜"というエラーが出ます. Adobe Reader 6.0に付いては.以前使っていましたが.現在は使っていません.履歴が残っているのではと思い.「アプリケーションの削除」を行おうとしましたが.同様なエ

  • Won't let me log in2 my itunes account, keeps asking for husbands account

    will not let me log in2 my itunes account 2 update/buy apps. keep asking 4 husbands password/account. No option to change/log in2 my Account