Announcement

Collapse
No announcement yet.

Generic Send_Email_Attachment Function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Generic Send_Email_Attachment Function

    Pretty annoying to have to install a custom module just to get the ability to attach files to an email. The current built in function only needs the ability to change the message. I.e.,

    It defaults to: By your request, Miva Merchant has emailed your exported file 'xxxxxx' from your 'Store Name Here' store.

    Which makes it useless to send emails to customers...
    Bruce Golub
    Phosphor Media - "Your Success is our Business"

    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
    phosphormedia.com

    #2
    You should be able to do something like this
    Code:
    <MvASSIGN NAME = "l.null"           VALUE = "{ [ g.Module_Library_Utilities ].StartMimeEmail( l.email_structure ) }">
    <MvASSIGN NAME = "l.null"           VALUE = "{ [ g.Module_Library_Utilities ].GenerateAttachmentMIME( l.email_structure, '', 'filename', 'filepath', 'script/data' ) }">
    <MvASSIGN NAME = "l.null"           VALUE = "{ [ g.Module_Library_Utilities ].GenerateBodyMIME( l.email_structure, 'text/plain', '', '', 'This is some additional data' ) }">
    <MvASSIGN NAME = "l.email"          VALUE = "">
    <MvASSIGN NAME = "l.email:to"       VALUE = "<to_address>">
    <MvASSIGN NAME = "l.email:from"     VALUE = "<from_address>">
    <MvASSIGN NAME = "l.email:subject"  VALUE = "<subject>">
    
    <MvIF EXPR = "{ NOT [ g.Module_Library_Utilities ].v9_SendMimeEmail( l.email_structure, l.email ) }">
        <MvEVAL EXPR = "{ 'Failed to send email' }">
    <MvELSE>
        <MvEVAL EXPR = "{ 'Email sent' }">
    </MvIF>
    or

    Code:
    <mvt:do name="l.null" file="g.Module_Library_Utilities" value="StartMimeEmail( l.email_structure )" />
    <mvt:do name="l.null" file="g.Module_Library_Utilities" value="GenerateAttachmentMIME( l.email_structure, '', 'filename', 'filepath', 'script/data' )" />
    <mvt:do name="l.null" file="g.Module_Library_Utilities" value="GenerateBodyMIME( l.email_structure, 'text/plain', '', '', 'This is some additional data' )">
    <mvt:assign name="l.email"            value="''" />
    <mvt:assign name="l.email:to"         value="'<to_address>'" />
    <mvt:assign name="l.email:from"       value="'<from_address>'" />
    <mvt:assign name="l.email:subject"    value="'<subject>'" />
    <mvt:do name="l.result" file="g.Module_Library_Utilities" value="v9_SendMimeEmail( l.email_structure, l.email )" />
    
    <mvt:if expr="NOT l.result">
        <mvt:eval expr="'Failed to send email'" />
    <mvt:else>
        <mvt:eval expr="'Email sent'" />
    </mvt:if>
    Last edited by dcarver; 06-28-17, 10:45 AM.
    David Carver
    Miva, Inc. | Software Developer

    Comment


      #3
      Well, that's pretty damn handy...thanks. Worked just as well as the custom module function i pieced together from the original Send_Email_Attachment() function...still think a Send_Email_Attachment(...., l.message) would be great.

      Thanks.
      Bruce Golub
      Phosphor Media - "Your Success is our Business"

      Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
      phosphormedia.com

      Comment

      Working...
      X