Auto Mail of Invoice in Prime

Discussion in 'Free Source Codes' started by Rajsrisrimal, May 3, 2023.

    
  1. Rajsrisrimal

    Rajsrisrimal Member


    Please help me to make corrections in the below code to work in Tally Prime for Auto mail of Invoices in PDF immediately after saving a voucher, I got this online



    [#Part : CMP TallyShopFeatures Left]

    Line : TlyTrng EmailFeatures


    [Line : TlyTrng EmailFeatures]

    Fields: Medium Prompt, TlyTrng EmailFeatures

    Local: Field : Medium Prompt : Info : "Enable Email Feature ?"

    Space Top
    : 0.3


    [Field : TlyTrng EmailFeatures]

    Use
    : Logical Field

    Storage
    : TlyTrng Email Features

    Sub Form
    : TlyTrng EmailConfigurations : $$Value


    [Report : TlyTrng EmailConfigurations]

    Title
    : "E-Mail Configurations"

    Form
    : TlyTrng EmailConfigurations

    Full Screen
    : No


    Set
    : SVAccounts : No

    Set
    : SVInventory : No

    Set
    : SVStatutory : No

    Set
    : SVTallyShop : Yes

    Set : SVTaxAudit : No

    Set : SVTallyNet : No


    [Form: TlyTrng EmailConfigurations]

    Parts
    : Form SubTitle, MPaySlip MailInfo Config

    Full Width : No

    Height
    : 60% Screen

    Space Right : 2

    Space Left : 2

    No Confirm : Yes

    Background : @@SV_CMPCONFIG

    Option : Small Size Form


    Local
    : Line : Default
    : NoCursor : Yes

    Local
    : Part : MPaySlip MailInfo Config : Delete
    : Border

    Local
    : Part : DSP ExcelExportDetails
    : Delete : Line
    : DSP ExportSheetName,

    Local
    : Part : MPaySlip MailInfo Config : Delete
    : Line : MPaySlip MailExportFormat

    Local
    : Line : Form SubTitle
    : Space Top : 0.25

    Local
    : Field : Form SubTitle
    : Info : $$LocaleString:"E-Mail Configuration"

    Local
    : Line : DSP ExcelExportWithFormatting : Local : Field
    : Short Prompt : Width
    : 30

    Local
    : Line : DSP ExcelExportWithColour : Local
    : Field : Short Prompt
    : Width : 30


    Local
    : Field : DSP Mail ServerName
    : Storage : TlyTrng Email MailServerName

    Local
    : Field : DSP Mail Server
    : Storage : TlyTrng Email MailServer

    Local
    : Field : DSP Mail UseSsl
    : Storage : TlyTrng Email MailUseSsl

    Local
    : Field : DSP Mail UseSSLOnStdPort : Storage
    : TlyTrng Email Mail UseSSLOnStdPort

    Local
    : Field : DSP MailFromAddress
    : Storage : TlyTrng Email MailFromAddress

    Local
    : Field : DSP MailAuthUserName
    : Storage : TlyTrng Email MailAuthUserName

    Local
    : Field : DSP MailAuthPassword
    : Storage : TlyTrng Email MailAuthPassword


    Local
    : Field : DSP MailAuthPassword
    : Delete : Inactive


    Local
    : Line : DSP MailAuthUNInfo
    : Invisible : Yes

    Local
    : Line : DSP MailFromName
    : Invisible : Yes


    Local
    : Line : DSP MailFromAddress
    : Space Top : 2






    [System : Formulae]

    TlyTrng Email Features
    : $TlyTrngEmailFeatures:Company:##SVCurrentCompany

    TlyTrng Email MailServerName
    : $TlyTrngEmailMailServerName:Company:##SVCurrentCompany

    TlyTrng Email MailServer
    : $TlyTrngEmailMailServer:Company:##SVCurrentCompany

    TlyTrng Email MailUseSsl
    : $TlyTrngEmailMailUseSsl:Company:##SVCurrentCompany

    TlyTrng Email Mail UseSSLOnStdPort : $TlyTrngEmailMailUseSSLOnStdPort:Company:##SVCurrentCompany

    TlyTrng Email MailFromAddress
    : $TlyTrngEmailMailFromAddress:Company:##SVCurrentCompany

    TlyTrng Email MailAuthUserName
    : $TlyTrngEmailMailAuthUserName:Company:##SVCurrentCompany

    TlyTrng Email MailAuthPassword
    : $TlyTrngEmailMailAuthPassword:Company:##SVCurrentCompany



    [System : UDF]

    TlyTrng Email Features
    : Logical : 3015

    TlyTrng Email MailServerName
    : String : 3016

    TlyTrng Email MailServer
    : String : 3017

    TlyTrng Email MailUseSsl
    : Logical : 3018

    TlyTrng Email Mail UseSSLOnStdPort : Logical
    : 3019

    TlyTrng Email MailFromAddress
    : String : 3020

    TlyTrng Email MailAuthUserName
    : String : 3021

    TlyTrng Email MailAuthPassword
    : String : 3022




    [#Form : Sales Color]

    On
    : Form Accept : @@TlyTrngEmailFeatures AND $$InCreateMode
    : Call : TlyTrng Email Vch
    : ($$Number:$CMPVchId:Company:##SVCurrentCompany)

    On
    : Form Accept : @@TlyTrngEmailFeatures AND $$InAlterMode
    : Call : TlyTrng Email Vch
    : $MasterId




    [Function : TlyTrng Email Vch]

    Parameter
    : VoucherId : String


    Variable
    : TlyTrng ToEmail : String
    : $EMAIL:LEDGER:$PARTYLEDGERNAME

    Variable
    : TlyTrng EmailSubject : String
    : "Voucher No. " + $VoucherNumber

    Variable
    : SVPrintFileName : String


    0000
    : If : NOT $$IsEmpty:##TlyTrngToEmail


    0010
    : Query Box : "Send Email"
    : Yes:No

    0020
    : If : NOT $$LastResult

    0030
    : Continue

    0040
    : End If


    0050
    : Set : SVMailEmbedImage
    : Yes

    0060
    : Set : SVExportFormatVar
    : $$SysName:pDF

    0070
    : Set : SVExportFormat
    : $$SysName:pDF

    0080
    : Set : SVBrowserWidth
    : 210

    0090
    : Set : SVBrowserHeight
    : 297


    0100
    : Set : SVMailAttachFileName
    : $$String:$Vouchernumber + ".pdf"


    0110
    : Set : SVPrintFileName
    : $$MakeMailName:##TlyTrngToEmail:mad:@TlyTrngEmailMailServer:mad:@TlyTrngEmailMailFromAddress:mad:@TlyTrngEmailMailFromAddress:##TlyTrngEmailSubject:mad:@TlyTrngEmailMailAuthUserName:mad:@TlyTrngEmailMailAuthPassword:mad:@TlyTrngEmailMailUseSsl:mad:@TlyTrngEmailMailUseSSLOnStdPort


    Local Formula
    : EMailText : "Dear Customer, \n Please find the invoice copy attached. \n\n Warm Regards,\n" + @@CmpMultiAddressMailName



    0120
    : Set : SVMailText
    : $$LocaleString:mad:EMailText


    0130
    : Mail : EMailVoucher
    : True


    0140
    : End If


    [Report : EMailVoucher]

    Title
    : "Voucher"

    Use
    : Printed Invoice

    Form
    : Printed Invoice


    Object
    : Voucher : $$SPrintf:"ID:%s":##VoucherId



    ;;End of the Code
     
    Last edited: May 10, 2023


Share This Page