Alpha DevCon 2018
Results 1 to 7 of 7

Thread: Specifying a pdf file name to email

  1. #1
    Member
    Real Name
    Bob Shipley
    Join Date
    Jul 2006
    Posts
    38

    Default Specifying a pdf file name to email

    I have a button that sets a variable to a value on a form then emails a copy of a report using the variable as a filter to only email the report for that record. I want to specify the pdf file name, i.e. Invoice 7890.pdf where 7890 is both the invoice number and the value of the variable. I can edit the subject to say "Emailing copy of invoice #7890" but I can't seem to find a way to name the file being emailed.

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Specifying a pdf file name to email

    Should we guess what code you are using or would it be possible for you to show it here? If you're using an action scripting element you'll probably have to convert it to xbasic and modify that.
    There can be only one.

  3. #3
    Member
    Real Name
    Bob Shipley
    Join Date
    Jul 2006
    Posts
    38

    Default Re: Specifying a pdf file name to email

    Code is:

    'Get 'Value' property of 'Invoice' in Form 'RECEIVABLE_FORM' .
    DIM SHARED InvoiceEmail AS n
    InvoiceEmail = parentform:Invoice.value

    'Send a report, label, letter, form or browse layout as an attachment to an e-mail message. You can specify which records to send.

    query.filter = "Invoice=Var->InvoiceEmail"
    query.order = "recno()"
    'replace variables in the filter with their actual values
    query.filter = convert_expression(query.filter,"VE")

    to_param = a5_eval_expression("",local_variables())
    cc_param = a5_eval_expression("",local_variables())
    bcc_param = a5_eval_expression("",local_variables())
    subject_param = a5_eval_expression("="Emailing Invoice #"+Var->InvoiceEmail",local_variables())
    message_param = a5_eval_expression("="Emailing Invoice #"+Var->InvoiceEmail",local_variables())


    :Report.Send("MASTER EMAIL INV","PDF",query.filter,query.order,"default",to_param,subject_param,message_param,cc_param,bcc_param)

  4. #4
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Specifying a pdf file name to email

    report.send() does not allow for the naming of the file to be emailed. To accomplish that you will need to use report.saveas() followed by email_send().

    Your current script can be condensed to


    Code:
     query.filter = "Invoice="+s_quote(parentform:Invoice.value)
     query.order = "recno()"
     to_param = ""
     cc_param = ""
     bcc_param = ""
     subject_param = "Emailing Invoice #"+parentform:Invoice.value
     message_param = "Emailing Invoice #"+parentform:Invoice.value
    There can be only one.

  5. #5
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,021

    Default Re: Specifying a pdf file name to email

    Did you using the ActionScript?

    The actionScript will not work for this case.


    The best option is Preview it and select the send_email button from Preview page without coding.
    Attached Images Attached Images

  6. #6
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Specifying a pdf file name to email

    He said

    I can't seem to find a way to name the file being emailed.
    I don't see where you answered that.
    There can be only one.

  7. #7
    Member
    Real Name
    don walters
    Join Date
    Mar 2002
    Location
    North Carolina
    Posts
    113

    Default Re: Specifying a pdf file name to email

    I have a client who sends out monthly invoices to their customers. Some are sent by postal and some by PDF Email. I have automated the Email so that it reads thru the daily invoice posting and checks the customer for the Email flag. Then stores the generated PDF in the "C:\XYZ\EmailPDF" folder as a way of verifying the sending of the PDF. If there is ever a question about the receipt they can resend from the email client.

    They also have customers that are not on a monthly maintenance contract so that customer will get an invoice the day after the work is done. Again some are postal and some Email. My client uses Mosilla Thunderbird for their Email client. I converted the Action scripting that you used to Xbasic and added a few lines to generate a PDF file that can be attached to the Email.

    The "report.send" action opens Thunderbird and attaches the "moz-mapi-1" PDF to the Email and then waits for the "Send" to be pressed. My client uses this for when they send solo invoices to their customers. It also allows them to address any additional conversation with their customers. They then delete the generated "moz-mapi-1" PDF and "Attach" the PDF generated by the coding below.

    Here is my coding for this:

    'Email the Invoice

    record_number = current_record_number()
    query.filter = "recno() = " + record_number
    query.order = ""

    to_param = a5_eval_expression("=Customer->Email",local_variables())
    cc_param = a5_eval_expression("",local_variables())
    bcc_param = a5_eval_expression("",local_variables())
    subject_param = a5_eval_expression("XYZ Invoice",local_variables())
    message_param = a5_eval_expression("="Attached is invoice "+Orderid+chr(13)+chr(10)+chr(10)+"please follow the link to Adobe and download the reader. You will then be able to open our invoices and statements."+chr(13)+chr(10)+chr(13)+chr(10)+"https://get.adobe.com/reader/"",local_variables())

    comp = a5_eval_expression("=Customer->company",local_variables())
    ord = a5_eval_expression("=orderid",local_variables())
    Fil = "C:\XYZ\EmailPDF\solo\ "+ ord + left(comp,10)+".pdf"
    fn = report.saveas("Order-Invoice", "PDF", "orders->orderid = ""+ord+""", "",Fil, .F.)

    :Report.Send("Order-Invoice","PDF",query.filter,query.order,"default",to_param,subject_param,message_param,cc_param,bcc_param)


    '
    I hope this will answer your question on how to get your PDF attached to your Email.

    Don

Similar Threads

  1. Email Outbox Log File
    By bob9145 in forum Mobile & Browser Applications
    Replies: 1
    Last Post: 01-14-2016, 07:57 PM
  2. Email Body needs to be inserted from a .htm File or .jpeg File
    By SMARTII in forum Alpha Five Version 9 - Desktop Applications
    Replies: 4
    Last Post: 03-17-2013, 12:27 PM
  3. File name that contains the email received
    By JackForman in forum Alpha Five Version 9 - Desktop Applications
    Replies: 4
    Last Post: 09-13-2009, 07:43 PM
  4. Email of a Pdf file
    By Dave Mac Callum in forum Alpha Five Version 7
    Replies: 4
    Last Post: 05-23-2008, 02:46 AM
  5. Email calling a txt file
    By EricN in forum Application Server Version 8
    Replies: 3
    Last Post: 04-03-2008, 06:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •