sending email without configuration is not working help me

Discussion in 'Tally Developer' started by mutharasan, Jan 10, 2019.

    
  1. mutharasan

    mutharasan Member


    Dear Admin and All Tdl Expert,

    I tried to code for desired report of mail sending without configuration screen from any form accept. I have just followed our Tally sample tdl. But it is not working. Please help me.

    [#Menu: GatewayofTally]

    Item: my auto mail : Alter: myautomail

    [Report: myautomail]

    Form: myautomail
    Object:company

    [Form: myautomail]

    Part: myautomail
    On : Form Accept : Yes : CALL : mymailfunction


    [Part: myautomail]

    Line: myautomail

    [Line: myautomail]

    Field: myautomail

    [Field: myautomail]

    Set as: "TDL EXPERTS"

    [Function: mymailfunction]

    Variable: SVMailServerName :String
    Variable: SVMailServer:String
    Variable: SVMailUseSsl:Logical
    Variable:SVMailUseSSLOnStdPort:Logical
    Variable :SVMailFromName:String
    Variable: SVMailFromAddress:String
    Variable:SVMailAuthUserName:String
    Variable: SVMailAuthPasswd:String
    Variable: SVMailFormat:String
    Variable:SVToMailId:String
    Variable:SVMailAttachFileName:String

    001 : Set: SVMailServerName:"Yahoo Mail"
    002 : Set: SVMailServer : "smtp.mail.yahoo.com:465"
    003 : Set : SVMailUseSsl : "yes"
    004 : Set: SVMailUseSSLOnStdPort:"No"
    005 : Set: SVMailFromName:"Arasan"
    006 : Set: SVMailFromAddress:"arasisoftsolutions@ymail.com"
    007 : Set: SVMailAuthUserName :"arasisoftsolutions@ymail.com"
    008 : Set: SVMailAuthPasswd:"xxxxxxxx"
    009 : Set: SVMailFormat:"PDF (Portable Document Format)"
    010 : Set: SVtomailid:"arasisoftsolutions@gmail.com"
    011 : Set: SVMailAttachFileName:"Day Book.pdf"

    012 : Mail:daybook:True
     


  2. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    What error messages you getting ??

    You have made a menu at Gateway..........so what / which -- REPORT is being mailed??
     


  3. mutharasan

    mutharasan Member


    Dear Amit Sir,

    Thank you very much for your reply.
    i want to send daybook. my query is without email configuration i want to send email when one form accept, that is all. The Error message is insufficient information.
     


  4. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    As far as my understanding goes....DAYBOOK is a form where there is "No Confirm" in place........... so I think...."on Form accept" will not work.

    Instead in Daybook report, you can provide a button on right side menu toolbar.........which user can click and activate your function.
     


  5. mutharasan

    mutharasan Member


    Dear amit sir,

    Thanks for your reply.

    Exactly my query is , I want to send email with out any configuration screen. i have given everything like email server, email id etc. in my function. i accept my form, the mail should be send automatically. now you understand sir.

    thanks in advance sir.
     


  6. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    I have understood and accordingly guided you. Please see my reply above once again.

    You need to provide a button............to activate email command...........

    the code given above....in present form.....will not work as you intend to............
     


  7. mutharasan

    mutharasan Member


    Dear Sir,

    Tally has given programmable configuration from Tally.Erp9 Release 1.6 and onward. We just give the values for the variable inside in the function. We can access the function through the form accept event. Please kindly consider it. I don't know whether i have missed something in my function. Please any body correct my code.

    Thanks in advance.
     


  8. Lynch

    Lynch Member


    Hi Mutharasan,
    I was also in the same situation to mail payslips to employees. I've used your code and modified as per my requirement. In the initial stage it was throwing error. as the file name is invalid.

    I've corrected your code as per the following
    Code:
    [Function: mymailfunction]
    /*
    Variable: SVMailServerName :String
    Variable: SVMailServer:String
    Variable: SVMailUseSsl:Logical
    Variable:SVMailUseSSLOnStdPort:Logical
    Variable :SVMailFromName:String
    Variable: SVMailFromAddress:String
    Variable:SVMailAuthUserName:String
    Variable: SVMailAuthPasswd:String
    Variable: SVMailFormat:String
    Variable:SVToMailId:String
    Variable:SVMailAttachFileName:String
    */
    Variable:vSVtoCCmailid:String ; just the variable to get CC mail id and mail subject are enough to declare. Other variables were already declared in the default TDL. we can just use them as it is.
    VARIABLE    : MailSubject    : String
    ; lines as appearing in the standard mailing function in the default TDL
    LOCAL FORMULA    : DSPToMailFormat    : If $$IsEmpty:##SVMailFromName Then ##SVMailFromAddress Else @DSPMailWithName
        LOCAL FORMULA    : DSPMailWithName    : '"' + ##SVMailFromName + '"<' + ##SVMailFromAddress + ">"
      
    04    : SET    : MailSubject        : "<Your mail subject>" ;##CostcentreName + " - Payslip - " + $$getPSperiod
    
    001 : Set: SVMailServerName:"Yahoo Mail"
    002 : Set: SVMailServer : "smtp.mail.yahoo.com:465"
    003 : Set : SVMailUseSsl : "yes"
    004 : Set: SVMailUseSSLOnStdPort:"No"
    005 : Set: SVMailFromName:"Arasan"
    006 : Set: SVMailFromAddress:"arasisoftsolutions@ymail.com"
    007 : Set: SVMailAuthUserName :"arasisoftsolutions@ymail.com"
    008 : Set: SVMailAuthPasswd:"xxxxxxxx"
    009 : Set: SVMailFormat:"PDF (Portable Document Format)"
    010 : Set: SVtomailid:"arasisoftsolutions@gmail.com"
    011 : Set: SVMailAttachFileName:"Day Book.pdf"
    
    012 : Set: vSVtoCCmailid:""; $ccEMailID:CostCentre:##CostcentreName ; in my code it will get cc mail id from employee cost centre
    013 : Set: SVMailBCC:""; "accounts@socialbeat.in" ; I've put my mail id as well to receive a bcc
    014 : Set: SVMailText:"<your body text>"   /* "Dear " + ##CostcentreName + " ," +
                + $$NewLine + "Please find the Payslip for the month" + $$getPSperiod +". Thanks for your contribution for the month" + $$NewLine +
                + "Thanks" + $$NewLine +
                + "Accounts Team"*/ ; in my code it is the body text for the payslip email
    
    015    :          SET    : SVPrintFileName    : $$MakeMailName:##SVtomailid:##SVMailServer:@DSPToMailFormat:##vSVtoCCmailid:##MailSubject:##SVMailAuthUserName:##SVMailAuthPasswd:##SVMailUseSSL:##SVMailUseSSLOnStdPort:##SVMailBCC
    
    
    016 : Mail:daybook:True
    
     


Share This Page