Offline market basket email functionality yielding nicely-formatted emails

I'm using htmlresources.zip contents in an InDesign folio to give some market basket functionality for customers working with sales reps. In the html/javascript/jquery code, I would like to allow the reps to send the basket info to the customers when they are ready, and I need the folio to work offline (so we’re not dependent on the internet for this app to function).  The problem I am having is that mailto: does not appear to work using html tags in all the popular email clients (so I’m not using html tags), and the columns in the body of my email only line up if the customers email display is using mono-spaced fonts (which is not always the case—btw, tabs do not appear to work very well with mailto either).  Hence, if our sales reps want the columns to line up nicely in the body of the email, I can only see a few options, namely: 1) stick with plain text mailto: issues, 2)write a separate XCode app to receive urls from the folio with all the email info included and then transmit those strings to a server-side mail server for transmission once internet connectivity is available, 3) somehow generate a pdf  (to make the basket pretty, line up columns, include nice pictures, etc.)  on the fly inside InDesign using Adobe api’s or using html5/javascript/jquery api’s and then include a link to that new pdf in the mailto: url or save the generated pdf off in the IPad somewhere.  In the latter case, reps can then use the IPad to manually email the pdf themselves when they are ready.  These are some things I’m working with and looking for some help in figuring out best methods.  Thank you.

Moved to DPS forum.

Similar Messages

  • Email Functionality:How to create Email Subject w/ more than 50 CHAR Length

    Hi All,
    I have a requirement that will send email, currently using FM SO_DOCUMENT_SEND_API1
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = w_doc_data  "Email Subj
          put_in_outbox              = 'X'
          sender_address             = w_username  "FROM EMAIL
          sender_address_type        = 'SMTP'
          commit_work                = 'X'
        TABLES
          packing_list               = t_objpack
          contents_txt               = t_text     "Email Body
          receivers                  = t_users    "TO EMAIL
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          document_type_not_exist    = 3
          operation_no_authorization = 4
          parameter_error            = 5
          x_error                    = 6
          enqueue_error              = 7
          OTHERS                     = 8.
    The email subject is being populated at parameter t_packing_list under structure SODOCCHGI1-OBJ_DESCR that can hold only up to 50 characters.
    In my requirement, the email subject is up to 50+ characters.
    Thanks All.

    Hi,
    Try below code:
    DATA: X_OBJECT_TYPE LIKE SOOD-OBJTP.
    DATA: BEGIN OF X_OBJECT_HD_CHANGE.
    INCLUDE STRUCTURE SOOD1.
    DATA: END OF X_OBJECT_HD_CHANGE.
    DATA: BEGIN OF X_OBJCONT OCCURS 10.
    INCLUDE STRUCTURE SOLI.
    DATA: END OF X_OBJCONT.
    DATA: BEGIN OF X_OBJHEAD OCCURS 0.
    INCLUDE STRUCTURE SOLI.
    DATA: END OF X_OBJHEAD.
    DATA: BEGIN OF RAW_HEAD.
    INCLUDE STRUCTURE SORH.
    DATA: END OF RAW_HEAD.
    DATA: BEGIN OF X_RECEIVERS OCCURS 0.
    INCLUDE STRUCTURE SOOS1.
    DATA: END OF X_RECEIVERS.
    PARAMETERS: RECEIVER LIKE X_RECEIVERS-RECNAM. " Name
    *BUILD MESSAGE HEADER
    MOVE 'Sort field goes here' TO X_OBJECT_HD_CHANGE-OBJSRT. " Sort field
    MOVE 'Name of the object goes here' TO X_OBJECT_HD_CHANGE-OBJNAM. " Name
    MOVE 'Document title goes here' TO X_OBJECT_HD_CHANGE-OBJDES. " Title
    MOVE 'F' TO X_OBJECT_HD_CHANGE-OBJSNS. " Functional OBJECT
    MOVE 'E' TO X_OBJECT_HD_CHANGE-OBJLA. " Language
    Object type of the new document
    MOVE 'RAW' TO X_OBJECT_TYPE.
    CLEAR X_OBJCONT.
    MOVE 'Contents of mail' TO X_OBJCONT-LINE.
    APPEND X_OBJCONT.
    CLEAR X_OBJCONT-LINE. APPEND X_OBJCONT.
    MOVE 'More contents' TO X_OBJCONT-LINE.
    APPEND X_OBJCONT.
    MOVE 'Still more contents'
    to x_objcont-line.
    APPEND X_OBJCONT.
    MOVE ' ' TO X_OBJCONT-LINE.
    APPEND X_OBJCONT.
    Specific header (Dependent on the object type, here RAW)
    REFRESH X_OBJHEAD.
    DESCRIBE TABLE X_OBJCONT LINES RAW_HEAD-RAWSIZ.
    MOVE RAW_HEAD TO X_OBJHEAD.
    APPEND X_OBJHEAD.
    *RECEIVERS table
    CLEAR X_RECEIVERS.
    REFRESH X_RECEIVERS.
    MOVE RECEIVER TO X_RECEIVERS-RECNAM. " Name
    MOVE 'B' TO X_RECEIVERS-RECESC. " Receiver type
    MOVE 'X' TO X_RECEIVERS-SNDCP. " Send as a copy
    MOVE 'X' TO X_RECEIVERS-SNDEX. " EXPRESS DOCUMENT
    APPEND X_RECEIVERS.
    CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
    folder_id = 'OUTBOX'
    forwarder = x_forwarder
    object_fl_change = x_object_fl_change
    OBJECT_HD_CHANGE = X_OBJECT_HD_CHANGE
    object_id = x_object_id
    OBJECT_TYPE = X_OBJECT_TYPE
    OUTBOX_FLAG = 'X'
    OWNER = SY-UNAME
    store_flag = x_store_flag
    importing
    object_id_new = x_object_id_new
    sent_to_all = x_sent_to_all "May need to use
    TABLES
    OBJCONT = X_OBJCONT
    OBJHEAD = X_OBJHEAD
    objpara = x_objpara
    objparb = x_objparb
    RECEIVERS = X_RECEIVERS.
    Regards,
    venkat.

  • Email function only allows log on by email address

    The Email function only allows an email address to be used as the log on.
    My ISP's email system uses a single word hostname, therefore I cannot set up an email account with valid SMTP log on credentials.
    This is obviously OK for systems like GMail, where xyz@gmail is used together with a password but there are many systems that require just xyz and a password.

    Hi,
    The fix for this bug, might fix the issue you have.
    NX-OS 5.2(6b) Release Notes
    http://www.cisco.com/en/US/docs/switches/datacenter/mds9000/sw/5_2/release/notes/nx-os/mds_nxos_rn_526b.html#wp916553
    CSCuc03438
    Symptom: The first SSH login on a Cisco MDS 9100 or 9200 Series switch always fails.
    Workaround: This issue is resolved
    Regards,
    David.

  • Proper syntax for email function including a repeat region

    Hey Guys, a fellow ADDT developer and myself ran into a odd challenge recently and was wondering if someone knew a shorter answer.
    LET ME BE CLEAR..I’m not looking for a suggestion, we have resolved the problem..we ARE LOOKING FOR PROPER or shortest FORMAT.
    (we used a submit redirect to a php page that used the “Send Page Section”  and then redirected back..the email looks great)
    This may be a mood point since ADDT is going away but, until then, we feel this will be an useful post because quite often you may have multiple products to email from your SQL statement.
    With that said. We used the send email function on submit.
    1.       Our email content was a HTML content file. Since it was not a php file our repeat region obviously did not work.
    2.       We substituted the HTML file for PHP (just for giggles)..no joy
    3.       We tried regular content as a string..no joy
    We know how to get single rows with the  {table.column} format…but we need to list all undetermined number of products/rows.
    So how would the string or function re-write look  if you needed a repeat region.
    EX:
    emailContent (“ this” . ‘does’. “work”);  regular string
    emailContent (“ this” . $var   . “work”);  regular string
    emailContent (“ this” .   do{  $row; } while( xxx = xxx)  . “work”);  DOES NOT WORK
    emailContent (“ this” .   while( xxx = xxx)  {  $row; }   . “work”);     DOES NOT WORK
    I assume the conflict is you can’t have a function like DO or While in the string….but I also can’t use a php include file.
    There must be a shorter, cleaner syntax that won’t require an advanced set of arrays or for each???
    so  how would a nice clean example of  repeat region results  inside email content, or include file for email contnent, look?
    Thanks

    David, in theory I agree with you, but to a large degree I am completely changing the logic of my human interface. My existing code pre-processes the raw data and saves the results to disk for any future usage. 
    It can then rapidly rebuild all pages for the entire Intranet site when your personal view of the data is changed. 
    After the full creation of all pages, the fixed pages can be viewed using your browser. 
    When you want to change your view, you run the code which completely rebuilds every Intranet page.
    My new software will approach the data differently.  My raw data will be stored with no pre-processing. The pre-processing will occur as the user changes dates and the pages will be built individually on demand, one at a time.
    The second phase of my Windows Form app will be to create pop-up windows that allow the users to modify the definitions for their custom views of the market. 
    When a view is changed, the software will be able to pre-process, as needed, the current date’s data and rebuild the current page with any new changes.
    I intend to create a Refresh.cpp file.  The various segments of the Form’s code will set variable such as date change, view changed, watch list changed, etc. and then call Refresh(). 
    The refresh code will then be able to do the minimum recalculation necessary to rebuild the proper HTML stream. 
    This is another reason to break up the code into various cpp segments such as: LoadRawData, RecalculateViews, BuildPage, etc.
    PS: David, I tried to send you a personal e-mail using your home page link. 
    Hope that was OK and not against forum rules!

  • Convert to Transaction Class to Use Market Basket Analysis Script (arules) in the Execute R Script Module

    Hello,
    I need to do Market Basket Analysis for my data, and have a working R script when using it in R Studio.  I need to transfer that R script to Azure ML Studio.  I read in another posting that the arules package is pre-installed and that I need
    to use the Execute R Script module since there is not other built-in module/function that does anything similar to Market Basket.  I went ahead and copy-paste my R script into the module with some slight modifications in terms of importing the data. 
    I use the R function read.transaction to import and convert my data frame (a csv file) into a transaction class directly from my working directory when using R Studio.  It appears that read.transaction does not work on Azure ML, and yet
    I need my data to be in transaction class for the rest of the functions in arules to work.  Therefore, how do I get around this?
    Thank you.

    Thanks.
    This is my R script:
    library(arules)
    library(arulesViz)
    # Contents of optional Zip port are in ./src/
    #source("src/MOD Targeting MBA ML.R");
    Data = read.transactions("src/data.csv", format = "single", sep = ",", cols = c(1,2))
    itemFrequencyPlot(Data, topN = 37, type = "absolute")
    Baskets = apriori(Data, parameter = list(supp = 0.001, conf = 0.8))
    inspect(Baskets)
    Results = as(Baskets, "data.frame")
    maml.mapOutputPort("Results")
    And this is the output log:
    Record Starts at UTC 12/23/2014 19:52:51:
    Run the job:"/dll "ExecuteRScript, Version=6.0.0.0, Culture=neutral, PublicKeyToken=69c3241e6f0468ca;Microsoft.MetaAnalytics.RDataSupport.ExecuteRScript;Run" /Output0 "..\..\Result Dataset\Result Dataset.dataset" /Output1 "..\..\R Device\R Device.dataset" /bundlePath "..\..\Script Bundle\Script Bundle.zip" /rStreamReader "script.R" "
    Starting process 'C:\Resources\directory\c3626c2575d5423e8cb58a9e7230be5e.SingleNodeRuntimeCompute.Packages\AFx\6.0\DllModuleHost.exe' with arguments ' /dll "ExecuteRScript, Version=6.0.0.0, Culture=neutral, PublicKeyToken=69c3241e6f0468ca;Microsoft.MetaAnalytics.RDataSupport.ExecuteRScript;Run" /Output0 "..\..\Result Dataset\Result Dataset.dataset" /Output1 "..\..\R Device\R Device.dataset" /bundlePath "..\..\Script Bundle\Script Bundle.zip" /rStreamReader "script.R" '
    [ModuleOutput] DllModuleHost Start: 1 : Program::Main
    [ModuleOutput] DllModuleHost Start: 1 : DataLabModuleDescriptionParser::ParseModuleDescriptionString
    [ModuleOutput] DllModuleHost Stop: 1 : DataLabModuleDescriptionParser::ParseModuleDescriptionString. Duration: 00:00:00.0050971
    [ModuleOutput] DllModuleHost Start: 1 : DllModuleMethod::DllModuleMethod
    [ModuleOutput] DllModuleHost Stop: 1 : DllModuleMethod::DllModuleMethod. Duration: 00:00:00.0000598
    [ModuleOutput] DllModuleHost Start: 1 : DllModuleMethod::Execute
    [ModuleOutput] DllModuleHost Start: 1 : DataLabModuleBinder::BindModuleMethod
    [ModuleOutput] DllModuleHost Verbose: 1 : moduleMethodDescription ExecuteRScript, Version=6.0.0.0, Culture=neutral, PublicKeyToken=69c3241e6f0468ca;Microsoft.MetaAnalytics.RDataSupport.ExecuteRScript;Run
    [ModuleOutput] DllModuleHost Verbose: 1 : assemblyFullName ExecuteRScript, Version=6.0.0.0, Culture=neutral, PublicKeyToken=69c3241e6f0468ca
    [ModuleOutput] DllModuleHost Start: 1 : DataLabModuleBinder::LoadModuleAssembly
    [ModuleOutput] DllModuleHost Verbose: 1 : Trying to resolve assembly : ExecuteRScript, Version=6.0.0.0, Culture=neutral, PublicKeyToken=69c3241e6f0468ca
    [ModuleOutput] DllModuleHost Verbose: 1 : Loaded moduleAssembly ExecuteRScript, Version=6.0.0.0, Culture=neutral, PublicKeyToken=69c3241e6f0468ca
    [ModuleOutput] DllModuleHost Stop: 1 : DataLabModuleBinder::LoadModuleAssembly. Duration: 00:00:00.0074580
    [ModuleOutput] DllModuleHost Verbose: 1 : moduleTypeName Microsoft.MetaAnalytics.RDataSupport.ExecuteRScript
    [ModuleOutput] DllModuleHost Verbose: 1 : moduleMethodName Run
    [ModuleOutput] DllModuleHost Information: 1 : Module FriendlyName : Execute R Script
    [ModuleOutput] DllModuleHost Information: 1 : Module Release Status : Release
    [ModuleOutput] DllModuleHost Stop: 1 : DataLabModuleBinder::BindModuleMethod. Duration: 00:00:00.0116536
    [ModuleOutput] DllModuleHost Start: 1 : ParameterArgumentBinder::InitializeParameterValues
    [ModuleOutput] DllModuleHost Verbose: 1 : parameterInfos count = 5
    [ModuleOutput] DllModuleHost Verbose: 1 : parameterInfos[0] name = dataset1 , type = Microsoft.Numerics.Data.Local.DataTable
    [ModuleOutput] DllModuleHost Verbose: 1 : Set optional parameter dataset1 value to NULL
    [ModuleOutput] DllModuleHost Verbose: 1 : parameterInfos[1] name = dataset2 , type = Microsoft.Numerics.Data.Local.DataTable
    [ModuleOutput] DllModuleHost Verbose: 1 : Set optional parameter dataset2 value to NULL
    [ModuleOutput] DllModuleHost Verbose: 1 : parameterInfos[2] name = bundlePath , type = System.String
    [ModuleOutput] DllModuleHost Verbose: 1 : parameterInfos[3] name = rStreamReader , type = System.IO.StreamReader
    [ModuleOutput] DllModuleHost Verbose: 1 : parameterInfos[4] name = seed , type = System.Nullable`1[System.Int32]
    [ModuleOutput] DllModuleHost Verbose: 1 : Set optional parameter seed value to NULL
    [ModuleOutput] DllModuleHost Stop: 1 : ParameterArgumentBinder::InitializeParameterValues. Duration: 00:00:00.0102003
    [ModuleOutput] DllModuleHost Verbose: 1 : Found trace source in Execute R Script module...
    [ModuleOutput] DllModuleHost Verbose: 1 : Begin invoking method Run ...
    [ModuleOutput] Microsoft Drawbridge Console Host [Version 1.0.2108.0]
    [ModuleOutput] [1] 56000
    [ModuleOutput]
    [ModuleOutput] The following files have been unzipped for sourcing in path=["src"]:
    [ModuleOutput]
    [ModuleOutput] Name Length Date
    [ModuleOutput]
    [ModuleOutput] 1 data.csv 2875965 2014-12-04 17:08:00
    [ModuleOutput]
    [ModuleOutput] 2 __MACOSX/ 0 2014-12-23 09:39:00
    [ModuleOutput]
    [ModuleOutput] 3 __MACOSX/._data.csv 120 2014-12-04 17:08:00
    [ModuleOutput]
    [ModuleOutput] Loading objects:
    [ModuleOutput]
    [ModuleOutput] Loading required package: Matrix
    [ModuleOutput]
    [ModuleOutput]
    [ModuleOutput]
    [ModuleOutput] Attaching package: 'arules'
    [ModuleOutput]
    [ModuleOutput]
    [ModuleOutput]
    [ModuleOutput] The following objects are masked from 'package:base':
    [ModuleOutput]
    [ModuleOutput]
    [ModuleOutput]
    [ModuleOutput] %in%, write
    [ModuleOutput]
    [ModuleOutput]
    [ModuleOutput]
    [ModuleOutput] Loading required package: grid
    [ModuleOutput]
    [ModuleOutput]
    [ModuleOutput] Attaching package: 'arulesViz'
    [ModuleOutput]
    [ModuleOutput] The following object is masked from 'package:base':
    [ModuleOutput]
    [ModuleOutput] abbreviate
    [ModuleOutput]
    [ModuleOutput] $value
    [ModuleOutput] NULL
    [ModuleOutput]
    [ModuleOutput] $visible
    [ModuleOutput] [1] FALSE
    [ModuleOutput]
    [ModuleOutput] Warning messages:
    [ModuleOutput] 1: In strptime(x, format, tz = tz) :
    [ModuleOutput] unable to identify current timezone 'C':
    [ModuleOutput] please set environment variable 'TZ'
    [ModuleOutput] 2: In strptime(x, format, tz = tz) : unknown timezone 'localtime'
    [ModuleOutput] DllModuleHost Stop: 1 : DllModuleMethod::Execute. Duration: 00:00:14.5396895
    [ModuleOutput] DllModuleHost Error: 1 : Program::Main encountered fatal exception: Microsoft.Analytics.Exceptions.ErrorMapping+ModuleException: Error 0063: The following error occurred during evaluation of R script:
    [ModuleOutput] ---------- Start of error message from R ----------
    [ModuleOutput] Error: Mapped variable must be of class type data.frame at this time.
    [ModuleOutput]
    [ModuleOutput]
    [ModuleOutput] Error: Mapped variable must be of class type data.frame at this time.
    [ModuleOutput] ----------- End of error message from R -----------
    Module finished after a runtime of 00:00:14.6091783 with exit code -2
    Module failed due to negative exit code of -2
    Record Ends at UTC 12/23/2014 19:53:07.
    Sorry, it won't let me send a link for some reason.
    Thanks.
    Cindy

  • Font size issue with the email functionality of infopath form

    Hi,
    We have a SharePoint list created and customised the form to send the form via email using email functionality in infopath form.
    We have made the font size of the form fields( rich text box) to 11. But it is showing as 10 in email. Also for a text box we set the font size to 14. But it is 13.5 in the email.
    Could anyone please let me know how to fix this issue?

    http://social.technet.microsoft.com/Forums/sharepoint/en-US/afbd9fc3-b8d3-4ef9-a8bf-9cb136d12039/formatting-problem-with-email-from-an-browser-enabled-infopath-2010-form-in-sharepoint-2010?forum=sharepointcustomizationprevious
    Yes, this is normal. Forms Services has to convert the form to an aspx page, and things get lost in translation when this gets submitted via email.  My workaround has always been to set static widths to columns/controls, but you said that didn't work
    for you?  It's always worked for me.
    https://go4answers.webhost4life.com/Example/infopath-send-form-email-162481.aspx
    http://www.formotus.com/15413/blog-infopath/making-the-most-of-email-submit-with-infopath-and-formotus-forms

  • Sending Formated email content using Mail Adapter !

    Hi,
    I would like to send email notification to customer using mail adapter, could you please to advise how to prepared the content of the email with little bit formated like sample below :
    Dear Madam / Sir
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxx :
    yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
    Best Regards,
    Since the constant function only can accept single line, how i can add change line.
    thank you and Best Regards
    Fernand

    Hi Fernand,
    There are a couple of blogs in SDN regarding sending formatted mail using Mail adapter. I guess there is one written by Prakash Arunachalam. Just do a search and it will give you some idea on using XSLT to achieve the result.
    If all you need is multi line in the content, use a UDF and use \n when ever you need a new line and \t for tab space.
    Regards,
    Jaishankar

  • Email smartform in html format

    Hello all,
    I've been searching SDN for help with creating an email in html format via smartforms. Pavan Bayyapu's blog was really helpful and I've also used program SF_XSF_DEMO_MAIL as the basis for my program.  I followed their examples exactly but my emails always appear as a .MTL attachment, never as just the body of the email. 
    I tried removing the file name from lo_mime_helper->set_main_html and from lo_mime_helper->add_binary_part as suggested by some other folks but I haven't had any success.
    Has anyone solved this same issue?  Maximum points will be given to helpful suggestions. 
    Thank you.

    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/59/cd7da407d711d5b66f006094192fe3/content.htm">converting SF to html format</a>
    Here is the code to send the Smartform to mail as PDF attachment.
    *& Report ZTEST_PDF_MAIL
    REPORT ZTEST_PDF_MAIL.
    Internal Table declarations
    DATA: I_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE,
    I_TLINE TYPE TABLE OF TLINE WITH HEADER LINE,
    I_RECEIVERS TYPE TABLE OF SOMLRECI1 WITH HEADER LINE,
    I_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
    Objects to send mail.
    I_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
    I_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
    I_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
    I_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
    Work Area declarations
    WA_OBJHEAD TYPE SOLI_TAB,
    W_CTRLOP TYPE SSFCTRLOP,
    W_COMPOP TYPE SSFCOMPOP,
    W_RETURN TYPE SSFCRESCL,
    WA_DOC_CHNG TYPE SODOCCHGI1,
    W_DATA TYPE SODOCCHGI1,
    WA_BUFFER TYPE STRING, "To convert from 132 to 255
    Variables declarations
    V_FORM_NAME TYPE RS38L_FNAM,
    V_LEN_IN LIKE SOOD-OBJLEN,
    V_LEN_OUT LIKE SOOD-OBJLEN,
    V_LEN_OUTN TYPE I,
    V_LINES_TXT TYPE I,
    V_LINES_BIN TYPE I.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    FORMNAME = 'ZTEST'
    IMPORTING
    FM_NAME = V_FORM_NAME
    EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    W_CTRLOP-GETOTF = 'X'.
    W_CTRLOP-NO_DIALOG = 'X'.
    W_COMPOP-TDNOPREV = 'X'.
    CALL FUNCTION V_FORM_NAME
    EXPORTING
    CONTROL_PARAMETERS = W_CTRLOP
    OUTPUT_OPTIONS = W_COMPOP
    USER_SETTINGS = 'X'
    IMPORTING
    JOB_OUTPUT_INFO = W_RETURN
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 4
    OTHERS = 5.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    I_OTF[] = W_RETURN-OTFDATA[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    FORMAT = 'PDF'
    MAX_LINEWIDTH = 132
    IMPORTING
    BIN_FILESIZE = V_LEN_IN
    TABLES
    OTF = I_OTF
    LINES = I_TLINE
    EXCEPTIONS
    ERR_MAX_LINEWIDTH = 1
    ERR_FORMAT = 2
    ERR_CONV_NOT_POSSIBLE = 3
    OTHERS = 4.
    IF SY-SUBRC <> 0.
    ENDIF.
    LOOP AT I_TLINE.
    TRANSLATE I_TLINE USING '~'.
    CONCATENATE WA_BUFFER I_TLINE INTO WA_BUFFER.
    ENDLOOP.
    TRANSLATE WA_BUFFER USING '~'.
    DO.
    I_RECORD = WA_BUFFER.
    APPEND I_RECORD.
    SHIFT WA_BUFFER LEFT BY 255 PLACES.
    IF WA_BUFFER IS INITIAL.
    EXIT.
    ENDIF.
    ENDDO.
    Attachment
    REFRESH: I_RECLIST,
    I_OBJTXT,
    I_OBJBIN,
    I_OBJPACK.
    CLEAR WA_OBJHEAD.
    I_OBJBIN[] = I_RECORD[].
    Create Message Body Title and Description
    I_OBJTXT = 'test with pdf-Attachment!'.
    APPEND I_OBJTXT.
    DESCRIBE TABLE I_OBJTXT LINES V_LINES_TXT.
    READ TABLE I_OBJTXT INDEX V_LINES_TXT.
    WA_DOC_CHNG-OBJ_NAME = 'smartform'.
    WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
    WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
    WA_DOC_CHNG-SENSITIVTY = 'F'.
    WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
    Main Text
    CLEAR I_OBJPACK-TRANSF_BIN.
    I_OBJPACK-HEAD_START = 1.
    I_OBJPACK-HEAD_NUM = 0.
    I_OBJPACK-BODY_START = 1.
    I_OBJPACK-BODY_NUM = V_LINES_TXT.
    I_OBJPACK-DOC_TYPE = 'RAW'.
    APPEND I_OBJPACK.
    Attachment (pdf-Attachment)
    I_OBJPACK-TRANSF_BIN = 'X'.
    I_OBJPACK-HEAD_START = 1.
    I_OBJPACK-HEAD_NUM = 0.
    I_OBJPACK-BODY_START = 1.
    DESCRIBE TABLE I_OBJBIN LINES V_LINES_BIN.
    READ TABLE I_OBJBIN INDEX V_LINES_BIN.
    I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
    I_OBJPACK-BODY_NUM = V_LINES_BIN.
    I_OBJPACK-DOC_TYPE = 'PDF'.
    I_OBJPACK-OBJ_NAME = 'smart'.
    I_OBJPACK-OBJ_DESCR = 'test'.
    APPEND I_OBJPACK.
    CLEAR I_RECLIST.
    I_RECLIST-RECEIVER = '[email protected]'.
    I_RECLIST-REC_TYPE = 'U'.
    APPEND I_RECLIST.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    DOCUMENT_DATA = WA_DOC_CHNG
    PUT_IN_OUTBOX = 'X'
    COMMIT_WORK = 'X'
    TABLES
    PACKING_LIST = I_OBJPACK
    OBJECT_HEADER = WA_OBJHEAD
    CONTENTS_BIN = I_OBJBIN
    CONTENTS_TXT = I_OBJTXT
    RECEIVERS = I_RECLIST
    EXCEPTIONS
    TOO_MANY_RECEIVERS = 1
    DOCUMENT_NOT_SENT = 2
    DOCUMENT_TYPE_NOT_EXIST = 3
    OPERATION_NO_AUTHORIZATION = 4
    PARAMETER_ERROR = 5
    X_ERROR = 6
    ENQUEUE_ERROR = 7
    OTHERS = 8.
    IF SY-SUBRC <> 0.
    WRITE:/ 'Error When Sending the File', SY-SUBRC.
    ELSE.
    WRITE:/ 'Mail sent'.
    ENDIF.
    If you want to send some text as Body of the Mail then follow this once
    when u r callin the FM'SO_NEW_DOCUMENT_ATT_SEND_API1'.. points to remember
    1.u have to pass the body of content in table CONTENTS_TXT(ia m using I_OBJBIN) (each line a record) then. suppose i have appended 11 records to the table CONTENTS_TXT .
    2.PACKING_LIST(iam usign I_OBJPACK) table u ahve to append a redord as follows
    I_OBJPACK-TRANSF_BIN = ' '.
    I_OBJPACK-HEAD_START = 000000000000001.
    I_OBJPACK-HEAD_NUM = 000000000000001.
    I_OBJPACK-BODY_START = 000000000000002
    I_OBJPACK-BODY_NUM = 000000000000010.
    I_OBJPACK-DOC_TYPE = 'RAW'.
    append I_OBJPACK-.
    by the above code system treat the first line in table I_OBJBIN as header and the 2nd line to 10 lines tread as body.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    DOCUMENT_DATA = WA_DOC_CHNG
    PUT_IN_OUTBOX = 'X'
    TABLES
    PACKING_LIST = I_OBJPACK
    OBJECT_HEADER = WA_OBJHEAD
    CONTENTS_BIN = I_OBJBIN
    CONTENTS_TXT = I_OBJTXT
    RECEIVERS = I_RECLIST
    EXCEPTIONS
    TOO_MANY_RECEIVERS = 1
    DOCUMENT_NOT_SENT = 2
    DOCUMENT_TYPE_NOT_EXIST = 3
    OPERATION_NO_AUTHORIZATION = 4
    PARAMETER_ERROR = 5
    X_ERROR = 6
    ENQUEUE_ERROR = 7
    OTHERS = 8.
    regards,
    srinivas
    <b>*reward for useful answers*</b>

  • Email functionality?

    The following text I found at the URL below that talks about delivering your content via email. Is there documentation on how to use and implement custom delivery channels? Also could you tell me what email functionality Ebusiness 11.5.10 or where are documents on it?
    http://www.oracle.com/technology/products/xml-publisher/index.html
    Deliver to Anywhere
    Deliver your content via printer, e-mail, fax, WebDav, or publish your report to a portal. The Delivery Manager's open architecture allows for easy implementation of custom delivery channels, as well.
    Thank you,
    Mark

    I was able to use a pl/sql and a generic email program to send out reports generated from BI publisher.
    This may look complicated but is easy if you break it out .
    Requirement:- Sales order summary report need to be send to sales agents as a nightly run.
    The process is simple
    1) create a generic email program that will accept the directory and has the capability to read blob then attach to the email.
    2) create a DIRECTORY in oracle database to point to APPLOUT
    3) create a custom package that will submit the concurrent program that will create the pdf report.note make sure to add the layout before submitting the concurrent program sample
    APPS.FND_REQUEST.ADD_LAYOUT('XBOL','XXCPD_OEXDRCAP','en-US','US','PDF');
    4) Based on your environment the output pdf will be created in the APPLOUT location in the format SHORT_NAME_REQUESTID_1.pdf
    5) call your generic email program to email this pdf.
    This is only an alternative method instead of messing around with java code. What i have seen is if the pl/sql is generic this is a repeatable and transportable process.
    Thank you,
    Tom
    WWW.CROOTPAD.COM

  • Mhtml embedded email not displaying proper format

    I am delivering a report through email 
    i am using mhtml as a render format for email delivery and report sending as a embedded email but,
    not report format displaying ...
    one thing when i see report in report manager it is displaying format nicely see..
    when i am exporting from Rpt manger its displaying perfect but when i use mhtml  rendering it s look like somewhat ..
    i have checked and its not any browser issue i guess ...
    i think can be rsconfig missing somewhere ...
    i have used mhtml as a embedded render format and extension mhtml (visible =false) already removed
    please help me on this... 
    Dilip Patil..

    Hello,
    I can reproduce the issue when I send to the report with MHTML to a Gmail address. But it works well when send to Microsoft Outlook email address. It seems the issue related to the Email services rather then SSRS MHTML Rendering Extension.
    Please try to change other email address and try again.
    Personally, I recommend you submit it to the Microsoft Connect at this link
    https://connect.microsoft.com/SQLServer/Feedback. This connect site will serve as a connecting point between you and Microsoft, and ultimately the large community for you and Microsoft to interact with. Your feedback enables Microsoft to offer the best
    software and deliver superior services, meanwhile you can learn more about and contribute to the exciting projects on Microsoft Connect.
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

  • Help with email function on new iPhoto?

    When I email photos to pc users the words are garbled and the layouts and text don't load in the same format. Is this an issue for others? Solution?
    Is there any way to get the old function of sending photos via email where I could add unlimited text? It worked great in the old version!
    Also once I select  photos and put them into an email via the email function, I can't delete one if I change my mind..... I have to delete the whole email and start over. Advice? Thanks

    Is there any way to get the old function of sending photos via email where I could add unlimited text? It worked great in the old version!
    iPhoto Menu -> Preferences -> General and choose your preferred email client there.
    Regards
    TD

  • Email attachment in pdf format not getting opened

    Dear freinds,
                     i have to send Payslip as PDF as email attachment. So i have used the FM  BAPI_GET_PAYSLIP_PDF and further passed the data to FM
    SO_NEW_DOCUMENT_ATT_SEND_API1.
    But, now  iam not able to open the attachment  which is in my inbox and it is giving message as the pdf as file is curropt. please could any one tell me what i have to do in this regard
    regards
    vamsi.

    Hi Sai,
    call function 'CONVERT_OTF'
          exporting
            format                = 'PDF'
            max_linewidth         = 132
          importing
            bin_filesize          = w_filesize
          tables
            otf                   = t_otf
            lines                 = t_line
          exceptions
            err_max_linewidth     = 1
            err_format            = 2
            err_conv_not_possible = 3
            err_bad_otf           = 4.
        loop at t_line.
          concatenate w_string t_line into w_string.
        endloop.                           " LOOP AT T_LINE
    *" convert the 132 line character to 255 character ....................
        do.
          t_attach = w_string.
          append t_attach.
          shift w_string left by 255 places.
          if w_string is initial.
            exit.
          endif.                           " IF W_STRING IS INITIAL
        enddo.                             " DO
        t_objbin[] = t_attach[].
    *" Body of the mail..................................................
        clear t_message. refresh t_message.
        t_message = 'This is a mail from SAP ECC6'.
        append t_message.
        t_message = 'Thanks and Regards'.
        append t_message.
        t_message = 'Sravanthi'.
        append t_message.
        describe table t_message lines w_msg.
    *" Document data.......................................................
        w_docdata-obj_name = 'SAPRPT'.
        w_docdata-expiry_dat = sy-datum + 10.
        w_docdata-obj_descr = 'Smartform  mail from Sravanthi'.
        w_docdata-sensitivty = 'F'.
        w_docdata-doc_size = w_msg * 255.
        w_docdata-obj_langu = sy-langu .
    *" Fill the packing list...............................................
        clear t_packing_list. refresh t_packing_list.
        t_packing_list-transf_bin = space.
        t_packing_list-head_start = 1.
        t_packing_list-head_num = 0.
        t_packing_list-body_start = 1.
        t_packing_list-body_num = w_msg.
        t_packing_list-doc_type = 'RAW'.
        append t_packing_list.
        t_packing_list-transf_bin = 'X'.
        describe table t_objbin lines w_objbin.
    *" doc_size = (lines in pdf table) * 255...............................
        t_packing_list-doc_size = w_objbin * 255.
        t_packing_list-body_num = w_objbin.
        t_packing_list-doc_type = 'PDF'.
        t_packing_list-obj_name = 'smart'.
        t_packing_list-obj_descr = 'test'.
        append t_packing_list.
    call function 'SO_DOCUMENT_SEND_API1'
          exporting
            document_data              = w_docdata
            put_in_outbox              = 'X'
            sender_address             = w_sender
            commit_work                = 'X'
          tables
            packing_list               = t_packing_list
            contents_bin               = t_objbin
            contents_txt               = t_message
            receivers                  = t_receivers
          exceptions
            too_many_receivers         = 1
            document_not_sent          = 2
            document_type_not_exist    = 3
            operation_no_authorization = 4
            parameter_error            = 5
            x_error                    = 6
            enqueue_error              = 7.
        if sy-subrc ne 0.
          write:/ 'Error When Sending the File', sy-subrc.
        else.
          write:/ 'Mail sent'.
        endif.
    Regards,
    Sravanthi

  • Formatting emails:I am using UTL_SMTP package foe sending them.

    Hi
    I created a PL/SQL job to schedule email sending. The code looks like:
    DECLARE
    l_mailhost VARCHAR2(64) := 'qiudubcorrel001.qa.local';
    l_from VARCHAR2(64) := '[email protected]';
    l_to VARCHAR2(64) := '[email protected]';
    l_mail_conn UTL_SMTP.connection;
    BEGIN
    l_mail_conn := UTL_SMTP.open_connection(('10.253.14.240'), 25);
    UTL_SMTP.helo(l_mail_conn, '10.253.14.240');
    UTL_SMTP.mail(l_mail_conn, l_from);
    UTL_SMTP.rcpt(l_mail_conn, l_to);
    UTL_SMTP.data(l_mail_conn, 'Single string message.' || Chr(13));
    UTL_SMTP.quit(l_mail_conn);
    END;
    The code works fine, but now I want to add colour to my email, or introduce other formatting as well. How can I do that here?
    Thanks,
    Kamal

    Here you can find HTML formatting
    * PROCEDURE NAME : XX_EMAIL_FILES
    * DESCRIPTION:
    * ==========
    * Sends e-mail (text and/or html, either as a string or from a file)
    * to one or more recipients (including cc and/or bcc recipients), along with
    * up to 3 file attachments (text and/or binary; default is text/plain), using
    * the UTL_SMTP package to send the e-mail, the DBMS_LOB package to read
    * binary file attachments, and the UTL_ENCODE package to convert the binary
    * attachments to BASE64 for character string (non-binary) transmission.
    * BE AWARE THAT A COMMIT MAY BE DONE BY THIS ROUTINE.
    * PARAMETERS:
    * ==========
    * The complete parameter list for the xx_email_files procedure is shown below:
    * NAME TYPE DESCRIPTION
    * from_name IN Name and e-mail address to put in the From field
    * to_names IN Names and e-mail addresses for the To field (separated by
    * commas or semicolons)
    * subject IN Text string for Subject field
    * message IN Text string or text file name for Message, if any
    * html_message IN Html string or html file name for Message, if any
    * cc_names IN Names and e-mail addresses for the Cc field, if any
    * (separated by commas or semicolons)
    * bcc_names IN Names and e-mail addresses for the Bcc field, if any
    * (separated by commas or semicolons)
    * filename1 IN First unix file pathname to attach, if any
    * filetype1 IN Mime type of first file (defaults to 'text/plain')
    * filename2 IN Second unix file pathname to attach, if any
    * filetype2 IN Mime type of second file (defaults to 'text/plain')
    * filename3 IN Third unix file pathname to attach, if any
    * filetype3 IN Mime type of third file (defaults to 'text/plain')
    * Sample names and e-mail addresses are: arun (attaches @),
    * [email protected], , xxx , and
    * "xxx"
    * A sample call in PL/SQL is shown below, which sends a text and html message,
    * plus a text file and two binary files (note: the slash after "end;" must be
    * the first character on it's line):
    * begin
    * xx_email_files(from_name => '[email protected]' ,
    * to_names => '[email protected]',
    * subject => 'A test',
    * message => 'A TEST MESSAGE',
    * html_message => '
    A test message
    * filename1 => '/ora_appl/oracle/11.5.0/data/xxx.pdf',
    * filename2 => '/usr/tmp/115apug.pdf',
    * filetype2 => 'application/pdf',
    * filename3 => '',
    * filetype3 => 'image/jpeg'
    * end
    * If the message or html_message string has a file name in it (starting with
    * a forward slash), the text or html file is copied into the e-mail as the
    * message or html message; otherwise, the message or html_message is copied
    * into the e-mail as-is.
    * Attachment file types (mime types) that I've tested include:
    * text/plain,
    * text/html,
    * image/jpeg,
    * image/gif,
    * application/pdf,
    * application/msword
    * A list of mime types can be seen at:
    * http://www.webmaster-toolkit.com/mime-types.shtml
    * If the mime type does not begin with "text", it is assumed to be a binary
    * file that will be encoded as base64 before transmission.
    CREATE OR REPLACE PROCEDURE xx_email_files (
    from_name VARCHAR2,
    to_names VARCHAR2,
    subject VARCHAR2,
    MESSAGE VARCHAR2 DEFAULT NULL,
    html_message VARCHAR2 DEFAULT NULL,
    cc_names VARCHAR2 DEFAULT NULL,
    bcc_names VARCHAR2 DEFAULT NULL,
    filename1 VARCHAR2 DEFAULT NULL,
    filetype1 VARCHAR2 DEFAULT 'text/plain',
    filename2 VARCHAR2 DEFAULT NULL,
    filetype2 VARCHAR2 DEFAULT 'text/plain',
    filename3 VARCHAR2 DEFAULT NULL,
    filetype3 VARCHAR2 DEFAULT 'text/plain'
    IS
    -- Change the SMTP host name and port number below to your own values,
    -- if not localhost on port 25:
    smtp_host VARCHAR2 (256) := 'localhost';
    smtp_port NUMBER := 25;
    -- Change the boundary string, if needed, which demarcates boundaries of
    -- parts in a multi-part email, and should not appear inside the body of
    -- any part of the e-mail:
    boundary CONSTANT VARCHAR2 (256) := 'CES.Boundary.DACA587499938898';
    recipients VARCHAR2 (32767);
    directory_path VARCHAR2 (256);
    file_name VARCHAR2 (256);
    crlf VARCHAR2 (2) := CHR (13) || CHR (10);
    mesg VARCHAR2 (32767);
    conn UTL_SMTP.connection;
    l_length NUMBER;
    l_sub VARCHAR2 (32767);
    TYPE varchar2_table IS TABLE OF VARCHAR2 (256)
    INDEX BY BINARY_INTEGER;
    file_array varchar2_table;
    type_array varchar2_table;
    i BINARY_INTEGER;
    -- Function to return the next email address in the list of email addresses,
    -- separated by either a "," or a ";". From Oracle's demo_mail. The format
    -- of mailbox may be in one of these:
    -- someone@some-domain
    -- "Someone at some domain"
    -- Someone at 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
    IS
    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;
    <>
    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;
    -- Procedure to split a file pathname into its directory path and file name
    -- components.
    PROCEDURE split_path_name (
    file_path IN VARCHAR2,
    directory_path OUT VARCHAR2,
    file_name OUT VARCHAR2
    IS
    pos NUMBER;
    BEGIN
    -- Separate the filename from the directory name
    pos := INSTR (file_path, '/', -1);
    IF pos = 0
    THEN
    pos := INSTR (file_path, '\', -1);
    END IF;
    IF pos = 0
    THEN
    directory_path := NULL;
    ELSE
    directory_path := SUBSTR (file_path, 1, pos - 1);
    END IF;
    file_name := SUBSTR (file_path, pos + 1);
    END;
    -- Procedure to append a file's contents to the e-mail
    PROCEDURE append_file (
    directory_path IN VARCHAR2,
    file_name IN VARCHAR2,
    file_type IN VARCHAR2,
    conn IN OUT UTL_SMTP.connection
    IS
    generated_name VARCHAR2 (30)
    := 'CESDIR' || TO_CHAR (SYSDATE, 'HH24MISS');
    directory_name VARCHAR2 (30);
    file_handle UTL_FILE.file_type;
    bfile_handle BFILE;
    bfile_len NUMBER;
    pos NUMBER;
    read_bytes NUMBER;
    line VARCHAR2 (1000);
    DATA RAW (200);
    my_code NUMBER;
    my_errm VARCHAR2 (32767);
    BEGIN
    BEGIN
    -- Grant access to the directory, unless already defined, and open
    -- the file (as a bfile for a binary file, otherwise as a text file).
    BEGIN
    line := directory_path;
    SELECT dd.directory_name
    INTO directory_name
    FROM dba_directories dd
    WHERE dd.directory_path = line AND ROWNUM = 1;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    directory_name := generated_name;
    END;
    IF directory_name = generated_name
    THEN
    EXECUTE IMMEDIATE 'create or replace directory '
    || directory_name
    || ' as '''
    || directory_path
    || '''';
    EXECUTE IMMEDIATE 'grant read on directory '
    || directory_name
    || ' to public';
    END IF;
    IF SUBSTR (file_type, 1, 4) != 'text'
    THEN
    bfile_handle := BFILENAME (directory_name, file_name);
    bfile_len := DBMS_LOB.getlength (bfile_handle);
    pos := 1;
    DBMS_LOB.OPEN (bfile_handle, DBMS_LOB.lob_readonly);
    ELSE
    file_handle := UTL_FILE.fopen (directory_name, file_name, 'r');
    END IF;
    -- Append the file contents to the end of the message
    LOOP
    -- If it is a binary file, process it 57 bytes at a time,
    -- reading them in with a LOB read, encoding them in BASE64,
    -- and writing out the encoded binary string as raw data
    IF SUBSTR (file_type, 1, 4) != 'text'
    THEN
    IF pos + 57 - 1 > bfile_len
    THEN
    read_bytes := bfile_len - pos + 1;
    ELSE
    read_bytes := 57;
    END IF;
    DBMS_LOB.READ (bfile_handle, read_bytes, pos, DATA);
    UTL_SMTP.write_raw_data (conn, UTL_ENCODE.base64_encode (DATA));
    pos := pos + 57;
    IF pos > bfile_len
    THEN
    EXIT;
    END IF;
    -- If it is a text file, get the next line of text, append a
    -- carriage return / line feed to it, and write it out
    ELSE
    UTL_FILE.get_line (file_handle, line);
    UTL_SMTP.write_data (conn, line || crlf);
    END IF;
    END LOOP;
    -- Output any errors, except at end when no more data is found
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    NULL;
    WHEN OTHERS
    THEN
    my_code := SQLCODE;
    my_errm := SQLERRM;
    DBMS_OUTPUT.put_line ('Error code ' || my_code || ': ' || my_errm);
    END;
    -- Close the file (binary or text)
    IF SUBSTR (file_type, 1, 4) != 'text'
    THEN
    DBMS_LOB.CLOSE (bfile_handle);
    ELSE
    UTL_FILE.fclose (file_handle);
    END IF;
    IF directory_name = generated_name
    THEN
    EXECUTE IMMEDIATE 'drop directory ' || directory_name;
    END IF;
    END;
    BEGIN
    -- Load the three filenames and file (mime) types into an array for
    -- easier handling later
    file_array (1) := filename1;
    file_array (2) := filename2;
    file_array (3) := filename3;
    type_array (1) := filetype1;
    type_array (2) := filetype2;
    type_array (3) := filetype3;
    -- Open the SMTP connection and set the From and To e-mail addresses
    conn := UTL_SMTP.open_connection (smtp_host, smtp_port);
    UTL_SMTP.helo (conn, smtp_host);
    recipients := from_name;
    UTL_SMTP.mail (conn, get_address (recipients));
    recipients := to_names;
    WHILE recipients IS NOT NULL
    LOOP
    UTL_SMTP.rcpt (conn, get_address (recipients));
    END LOOP;
    recipients := cc_names;
    WHILE recipients IS NOT NULL
    LOOP
    UTL_SMTP.rcpt (conn, get_address (recipients));
    END LOOP;
    recipients := bcc_names;
    WHILE recipients IS NOT NULL
    LOOP
    UTL_SMTP.rcpt (conn, get_address (recipients));
    END LOOP;
    UTL_SMTP.open_data (conn);
    -- Build the start of the mail message
    mesg :=
    'Date: '
    || TO_CHAR (SYSDATE, 'dd Mon yy hh24:mi:ss')
    || crlf
    || 'From: '
    || from_name
    || crlf
    || 'Subject: '
    || subject
    || crlf
    || 'To: '
    || to_names
    || crlf;
    IF cc_names IS NOT NULL
    THEN
    mesg := mesg || 'Cc: ' || cc_names || crlf;
    END IF;
    IF bcc_names IS NOT NULL
    THEN
    mesg := mesg || 'Bcc: ' || bcc_names || crlf;
    END IF;
    mesg :=
    mesg
    || 'Mime-Version: 1.0'
    || crlf
    || 'Content-Type: multipart/mixed; boundary="'
    || boundary
    || '"'
    || crlf
    || crlf
    || 'This is a Mime message, which your current mail reader may not'
    || crlf
    || 'understand. Parts of the message will appear as text. If the remainder'
    || crlf
    || 'appears as random characters in the message body, instead of as'
    || crlf
    || 'attachments, then you''ll have to extract these parts and decode them'
    || crlf
    || 'manually.'
    || crlf
    || crlf;
    UTL_SMTP.write_data (conn, mesg);
    -- Write the text message or message file, if any
    IF MESSAGE IS NOT NULL
    THEN
    mesg :=
    || boundary
    || crlf
    || 'Content-Type: text/plain; name="message.txt"; charset=US-ASCII'
    || crlf
    || 'Content-Disposition: inline; filename="message.txt"'
    || crlf
    || 'Content-Transfer-Encoding: 7bit'
    || crlf
    || crlf;
    UTL_SMTP.write_data (conn, mesg);
    IF SUBSTR (MESSAGE, 1, 1) = '/'
    THEN
    split_path_name (MESSAGE, directory_path, file_name);
    append_file (directory_path, file_name, 'text', conn);
    UTL_SMTP.write_data (conn, crlf);
    ELSE
    UTL_SMTP.write_data (conn, MESSAGE || crlf);
    END IF;
    END IF;
    IF html_message IS NOT NULL
    THEN
    mesg :=
    || boundary
    || crlf
    || 'Content-Type: text/html; name="message.html"; charset=US-ASCII'
    || crlf
    || 'Content-Disposition: inline; filename="message.html"'
    || crlf
    || 'Content-Transfer-Encoding: 7bit'
    || crlf
    || crlf;
    UTL_SMTP.write_data (conn, mesg);
    IF SUBSTR (html_message, 1, 1) = '/'
    THEN
    split_path_name (html_message, directory_path, file_name);
    append_file (directory_path, file_name, 'text', conn);
    UTL_SMTP.write_data (conn, crlf);
    ELSE
    UTL_SMTP.write_data (conn, html_message || crlf);
    END IF;
    END IF;
    -- Append the files
    FOR i IN 1 .. 3
    LOOP
    -- If the filename has been supplied ...
    IF file_array (i) IS NOT NULL
    THEN
    split_path_name (file_array (i), directory_path, file_name);
    -- Generate the MIME boundary line according to the file (mime) type
    -- specified.
    mesg := crlf || '--' || boundary || crlf;
    SELECT INSTR (file_name, '.')
    INTO l_length
    FROM DUAL;
    SELECT SUBSTR (file_name, 1, l_length - 1) || '.pdf'
    INTO l_sub
    FROM DUAL;
    IF SUBSTR (type_array (i), 1, 4) != 'text'
    THEN
    mesg :=
    mesg
    || 'Content-Type: '
    || type_array (i)
    || '; name="'
    || file_name
    || '"'
    || crlf
    || 'Content-Disposition: attachment; filename="'
    || file_name
    || '"'
    || crlf
    || 'Content-Transfer-Encoding: base64'
    || crlf
    || crlf;
    ELSE
    mesg :=
    mesg
    || 'Content-Type: application/octet-stream; name="'
    || file_name
    || '"'
    || crlf
    || 'Content-Disposition: attachment; filename="'
    || file_name
    || '"'
    || crlf
    || 'Content-Transfer-Encoding: 7bit'
    || crlf
    || crlf;
    END IF;
    UTL_SMTP.write_data (conn, mesg);
    -- Append the file contents to the end of the message
    append_file (directory_path, file_name, type_array (i), conn);
    UTL_SMTP.write_data (conn, crlf);
    END IF;
    END LOOP;
    -- Append the final boundary line
    mesg := crlf || '--' || boundary || '--' || crlf;
    UTL_SMTP.write_data (conn, mesg);
    -- Close the SMTP connection
    UTL_SMTP.close_data (conn);
    UTL_SMTP.quit (conn);
    END;
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com

  • Design a function module to send email

    hii gurus ,    
                 i have to design a function module which takes three input  email id (reciever),   body (text of message) , and header  ie subject and  when executed should send email to the reciever.  pls  help
    Aditya Shrivastava.

    Hi Aditya,
    If you could not get your problem solved with predefined FMs, Try making this FM.. it will help you..as this FM is made in our server locally..
    name  :   z938_mailsend
    import parameters
    param name      type     associated type           shrt text
    I_TID           LIKE      THEAD-TDID                        Text ID of text to be read
    I_LAN           LIKE     THEAD-TDSPRAS                        Language of text to be read
    I_L_NAME     LIKE     THEAD-TDNAME                        Name of text to be read
    I_OID          LIKE     THEAD-TDOBJECT                        Object of text to be read
    W_RETURN     TYPE     SSFCRESCL                        Smart Forms: Return value at end of form printing
    I_POTITLE     TYPE     EBELN                               purchase order number
    W_DOC_CHNG     TYPE     SODOCCHGI1                       data of an object which can be changed
    I_ADDRNUM     LIKE     ADR6-ADDRNUMBER               Address number of Vendor
    source code :
    FUNCTION z938_mailsend.
    ""Local Interface:
    *"  IMPORTING
    *"     REFERENCE(I_TID) LIKE  THEAD-TDID
    *"     REFERENCE(I_LAN) LIKE  THEAD-TDSPRAS
    *"     REFERENCE(I_L_NAME) LIKE  THEAD-TDNAME
    *"     REFERENCE(I_OID) LIKE  THEAD-TDOBJECT
    *"     REFERENCE(W_RETURN) TYPE  SSFCRESCL
    *"     REFERENCE(I_POTITLE) TYPE  EBELN
    *"     REFERENCE(W_DOC_CHNG) TYPE  SODOCCHGI1
    *"     REFERENCE(I_ADDRNUM) LIKE  ADR6-ADDRNUMBER
    *data declaration
    *Internal Table declaration
      DATA : it_otf     TYPE STANDARD TABLE OF  itcoo ,
             it_tline   TYPE STANDARD TABLE OF  tline ,
             it_record  TYPE STANDARD TABLE OF  solisti1,
             it_objpack TYPE STANDARD TABLE OF  sopcklsti1,
             it_objtxt  TYPE STANDARD TABLE OF  solisti1 ,
             it_objbin  TYPE STANDARD TABLE OF  solisti1 ,
             it_reclist TYPE STANDARD TABLE OF  somlreci1 ,
             it_tdline  TYPE STANDARD TABLE OF  tline,
    *Work Area declarations
             wa_objhead     TYPE  soli_tab,
             wa_buffer      TYPE  string,       "To convert from 132 to 255
             wa_it_objtxt   TYPE  solisti1,
             wa_it_objpack  TYPE  sopcklsti1,
             wa_it_record   TYPE  solisti1,
             wa_it_reclist  TYPE  somlreci1,
             wa_it_tline    TYPE  tline,
             wa_tdline      TYPE  tline,
    *variable declaration
             v_lines_bin    TYPE  i,
             v_lines_txt    TYPE  i,
             v_len_in       TYPE  sood-objlen,         "#EC NEEDED
             v_mailaddr     TYPE  adr6-smtp_addr.
    *constant declaration
      CONSTANTS : c_msgtype TYPE c VALUE 'E',    " for declaring masseage type as error msg
                  c_X TYPE c VALUE 'X',
                  c_U TYPE c VALUE 'U'.
      it_otf[] = w_return-otfdata[].
    *calling function module to convert otf format of smartform to pdf format
      CALL FUNCTION 'CONVERT_OTF'
       EXPORTING
         format                      = text-001     "PDF
         max_linewidth               = 132
        ARCHIVE_INDEX              =
        COPYNUMBER                 =
        ASCII_BIDI_VIS2LOG         =
        PDF_DELETE_OTFTAB          =
       IMPORTING
         bin_filesize                = v_len_in
        BIN_FILE                   =
        TABLES
          otf                        = it_otf
          lines                      = it_tline
       EXCEPTIONS
         err_max_linewidth           = 1
         err_format                  = 2
         err_conv_not_possible       = 3
         err_bad_otf                 = 4
         OTHERS                      = 5  .
      IF sy-subrc NE 0.
        sy-msgid = text-002.     "some msg
        sy-msgty = c_msgtype.    " E
        sy-msgno = 040.
        sy-msgv1 = ' '.
        sy-msgv2 = ' '.
        sy-msgv3 = ' '.
        sy-msgv4 = ' '.
        EXIT.
      ELSE.
    Convert PDF from 132 to 255.
        LOOP AT it_tline INTO wa_it_tline.
          TRANSLATE wa_it_tline USING ' ~'.      " Replacing space by ~
          CONCATENATE wa_buffer wa_it_tline INTO wa_buffer.
        ENDLOOP.
        TRANSLATE wa_buffer USING '~ '.         " Replacing space by ~
        DO.
          wa_it_record = wa_buffer.
          APPEND wa_it_record TO it_record.     " Appending 255 characters as a record
          SHIFT wa_buffer LEFT BY 255 PLACES.
          IF wa_buffer IS INITIAL.
            EXIT.
          ENDIF.
        ENDDO.
        REFRESH:it_objbin.
        CLEAR wa_objhead.
    Object with PDF.
        it_objbin[] = it_record[].
        DESCRIBE TABLE it_objbin LINES v_lines_bin.
    *calling a function module read_text to get the text for the mail body
        CALL FUNCTION 'READ_TEXT'
         EXPORTING
            id                            = i_tid
            language                      = i_lan
            name                          = i_l_name
            object                        = i_oid
        IMPORTING
        HEADER                          =
         TABLES
            lines                         = it_tdline
         EXCEPTIONS
           id                             = 1
           language                       = 2
           name                           = 3
           not_found                      = 4
           object                         = 5
           reference_check                = 6
           wrong_access_to_archive        = 7
         OTHERS                           = 8
        IF sy-subrc <> 0.    "#EC
        ENDIF.
        IF it_tdline IS NOT INITIAL.
          LOOP AT it_tdline INTO wa_tdline.
            wa_it_objtxt = wa_tdline-tdline.
            APPEND wa_it_objtxt TO it_objtxt.
            CLEAR: wa_tdline,
                   wa_it_objtxt.
          ENDLOOP.
          DESCRIBE TABLE it_objtxt LINES v_lines_txt.
        ENDIF.
    Pack to main body as RAW.
        CLEAR wa_it_objpack-transf_bin.        "Obj. to be transported not in binary form
        wa_it_objpack-head_start = 1.          "Start line of object header in transport packet
        wa_it_objpack-head_num = 0.            "Number of lines of an object header in object packet
        wa_it_objpack-body_start = 1.          "Start line of object contents in an object packet
        wa_it_objpack-body_num = v_lines_txt.  "Number of lines of the object contents in an object packet
    Code for document class
        wa_it_objpack-doc_type = text-004.        "RAW
        APPEND wa_it_objpack TO it_objpack.
    Packing as PDF.
        wa_it_objpack-transf_bin = c_X.           " X
        wa_it_objpack-head_start = 1.
        wa_it_objpack-head_num = 1.
        wa_it_objpack-body_start = 1.
        wa_it_objpack-body_num = v_lines_bin.
        wa_it_objpack-doc_type = text-001.        "PDF
        wa_it_objpack-obj_name = text-006.        "SmartForm
        CONCATENATE i_potitle '.pdf' INTO wa_it_objpack-obj_descr.
        wa_it_objpack-doc_size = v_lines_bin * 255.
        APPEND wa_it_objpack TO it_objpack.
    Document information.
        CLEAR wa_it_reclist.
    e-mail receivers.
        SELECT SINGLE smtp_addr FROM adr6 INTO v_mailaddr    "#EC *
         WHERE addrnumber = i_addrnum.
        wa_it_reclist-receiver = v_mailaddr.
        wa_it_reclist-express = c_X.                        " X
        wa_it_reclist-rec_type = c_U.                       "U -> Internet address
        APPEND wa_it_reclist TO it_reclist.
    Sending Mail
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
         EXPORTING
          document_data                  = w_doc_chng
          put_in_outbox                  = c_X            "X
        COMMIT_WORK                    =
       IMPORTING
        SENT_TO_ALL                    =
        NEW_OBJECT_ID                  =
         TABLES
          packing_list                   = it_objpack
          object_header                  = wa_objhead
          contents_bin                   = it_objbin
          contents_txt                   = it_objtxt
        CONTENTS_HEX                   =
        OBJECT_PARA                    =
        OBJECT_PARB                    =
            receivers                    = it_reclist
         EXCEPTIONS
           too_many_receivers            = 1
           document_not_sent             = 2
           document_type_not_exist       = 3
           operation_no_authorization    = 4
           parameter_error               = 5
           x_error                       = 6
           enqueue_error                 = 7
           OTHERS                        = 8 .
        IF sy-subrc <> 0.
          sy-msgid = text-008.      "some msg
          sy-msgty = c_msgtype.     " E
          sy-msgno = 041.
          sy-msgv1 = ' '.
          sy-msgv2 = ' '.
          sy-msgv3 = ' '.
          sy-msgv4 = ' '.
          EXIT.
        ENDIF.
      ENDIF.
    ENDFUNCTION.
    Regards,,
    Nikita

  • Creating a nicely formatted PDF output, suggestions/stratigies?

    I really wanted to call this "Stupid Questions 101", but figured this was probably a better thread title.
    I think this is going to rather long, as I have many variables and other considerations, so let me start off trying to explain.
    I finally have my application pretty much finished (at least the initial version, have to see what users say). Now, I also need to add the capability for a nicely formatted report that's rather complicated, preferably as a PDF file. The final result needs to look like pages from a book (different fonts, lots of whitespace, left, right and center alignement, etc.) instead of a standard report layout.
    So first, I have about 30 tables (views actually). For this application, I need to produce a report that goes through all of the views and 'dumps' all of the information in each table for whatever 'parent' record the user wants. There's going to be lots of looping, and I have the typical parent - child - grandchild relationships, so when I'm printing the child record, before progressing to the next child record, I also need to print all of the assosciated grandchild records.
    A couple views can be simply output in one line, like the simple report format. Most views though need to formatted across multiple lines, like a form. Many fields will also need to be wrapped across multiple lines, adding to the whitespace and indenting problem.
    All together, I have around 300 fields or so that I need output, so as I understand it, ApEx itself can't handle this as a web page (besides all the various looping problems, but also the 100 'item' limit), so I'm thinking that I'll need to create a page with a PL/SQL region and write a package (with all of the views getting their own procedure), that will go through all of the looping etc. I'll need for the 'dump'.
    So, I'm wondering which is the best approach to take on this, I don't think I can use a PSP page to accomplish this, so I think I just need to use the web toolkit.
    1. Should I start my PL/SQL region off with the "pre" tag, so my 'layout' stays intact?
    2. I'll also need to print my field 'labels' in bold, so will the "pre" tag interfere with that?
    3. Will it be easier to place the htp.p statements in my package's procedures, or just write the package with the htp.p statements and add those with the PL/SQL region on the page? (But then I'll need to use dbms.output to send the data to the region won't I?)
    4. Since this will wind up (hopefully) as a nicely formatted region on the page (with lots of whitespace, etc.), will the FOP package allow me to create it (just the region, not the entire page) as a PDF, or does the FOP package only work with standard ApEx 'reports'?
    5. Am I way off base here, or is there a better aproach I'm missing? I really need to try and keep everything free (otherwise I'd consider PL/PDF), as being in the government, money is usually pretty tight, we usually only have money just for our salaries and office space.
    Like I said above, pretty stupid questions, but I haven't used the web toolkit in about 7 years or so, being tied up with merging two database and cleaning up the data from one of them (it had no data validation or integrity constraints at all, everything was a free-form field, like a giant spreadsheet).
    Thanks for any suggestions on how to best tackle this next stage of my problem.
    Of to start experimenting some.
    Bill Ferguson

    For anybody following this, here's a couple updates.
    I decided to go with an internal stylesheet, vs. an external (one less file I need to worry about moving during an upgrade, machine change, etc.). Since I'm generating the entire page through a PL/SQL package anyway, the internal stylesheet stays with the code, just in a separate procedure.
    I'm having problems getting a button to fire off the javascript to popup a new window that runs the package. I can run the package fine if I start a new window manually and supply the URL/user.package.procedure, so it's something with where I'm placing the javascript call. I've searched the forums, and the closest I found to an answer was to add the code to the "Image Attributes", but when I tried that, it insisted on an image also being specified. Since I don't have an image, or know of any, I tried both the "HTML Button" and "Template Based Button", but those grey out the "Image Attributes", and the javascript doesn't seem to fire from the "Button Attributes".
    The (edited) javascript call is:
    onclick="javascript:MypopUp2
    ('http://my_machine:my_port/mrds/usgs.print_site.print_doc?dep_id_in=&P0_DEP_ID.',800,600);"Anybody have any ideas on what/where I really need to place this? The javascript does work elsewhere, it's simply a copy of the popup2 script in core.js that I moved over into my own javascript file.
    On a different note, since I'm learning about css as I progress, I discovered that using "div" "/div" causes a new line, while "span" "/span" does not (angle brackets replaced with quotes). Took me a while to get figured out, it was really messing up my formatting, so maybe somebody else just learning this css stuff can save a few headaches.
    Hope somebody knows where to add the code to the button. :^)
    Bill Ferguson

Maybe you are looking for

  • Ipod touch's battery won't charge... see red battery

    My ipod touch won't charge or turn on. I have tried charging it for more then 10 hours but it still won't charge. All i see is the red battery sign. I have the right charger and i plug it into the wall. Any help?

  • Convert a Word text box into a PDF file

    Am trying to convert a Word (2007) document that contains several text boxes in it, but they are not being converted into the PDF file.  Some are though, some aren't. Any suggestions?

  • Solution and problem about USB port shutdown in thunderbolt

    Problem: Recently, i find that all USB port, audio in my thunderbolt have been disabled and when i restart computer, it will work for a while, i play a song, the audio go through display for a while, then go to Internal Speakers. In System Preference

  • Using Active Directory to connect to OS X VPN

    I have 2 servers in my infrastructure that handle my entire small business.  I have a MacMini with Mountain Lion and Server running along with Windows SBS.  The Mountain Lion server has a lot of resources that we use, namely the VPN.  When my users a

  • Help me open photoshop files created in '97

    I have archives of photoshop format files that were created in '96-2000 that CS5 will not open. Is there a translator or updater that will enable these files to be opened?