Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Auto mailer

I have a qvw with some text in textbox object and tabular data below it. I want to create an auto mailer macro to send the textbox and the table below it in the body of the mail. I want table as a table in the mail body and not as a jpg or any image which will help me to select the data in the table from the mail body. This is just a sample, we have multiple qvw sheets with multiple objects that need to be used in the body of the mail. Need it a bit urgently.

Untitled.jpg

7 Replies
Anonymous
Not applicable
Author

Why not you export the data in excel and then attach this to the mail.

This can be easily done.

You can follow the below link to find how to export data to excel and send mails through macros.....

QlikView Macros – Useful collection | Lucian Cotea

Regards

Nitin

vikasmahajan

Please refer sample application will help you to achieve the same.

Good Luck.

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
Not applicable
Author

Hi Vikas, It seems to send the data as an attachment, but we wanted the object to pasted in the body of the mail and sent thru mail and not as an attachment

Not applicable
Author

Use the below script

sub Sendmail

Dim objEmail

    Dim strMailTo

 

    Const cdoSendUsingPort = 2    ' Send the message using SMTP

 

    Const cdoAnonymous = 0    'Do not authenticate

    Const cdoBasic = 1        'basic (clear-text) authentication

    Const cdoNTLM = 2        'NTLM

 

    Const SMTPServer = "-------------------------------------------------"

    Const SMTPPort = 25                ' Port number for SMTP

    Const SMTPTimeout = 60              ' Timeout for SMTP in seconds

 

 

        'Send mail

        Set objEmail = CreateObject("CDO.Message")

        Set objConf = objEmail.Configuration

        Set objFlds = objConf.Fields

     

        With objFlds

            '---------------------------------------------------------------------

            ' SMTP server details

            .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort

            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer

            .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoAnonymous

              .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPPort

              .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False

            .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = SMTPTimeout

            .Update

            '---------------------------------------------------------------------

        End With

     

        SET obj = ActiveDocument.GetSheetObject("CH02")

                 

                    varFileName = "Testhtm.htm"

                    varPathFile = "F:\Testhtm.htm"

                    ActiveDocument.GetApplication().WaitForIdle

                    obj.ExportHTML varPathFile

                    msgbox "Created"             

                 

        objEmail.To = "------------------------------"

     

        objEmail.From = "----------------------------"

        objEmail.Subject = "Test mail"

        objEmail.CreateMHTMLBody "F:\Testhtm.htm"

    

        objEmail.Send

        msgbox "Mail send"

     

        Set objFlds = Nothing

        Set objConf = Nothing

        Set objEmail = Nothing

End Sub

Not applicable
Author

Hi,

you can use alert option by concating all the fields in your table.

Regards,

Piyush

Not applicable
Author

Tried the code but getting an error "The transport failed to connect to the server." in spite of adding the smtp address

vikasmahajan

Insert SMTP server ip number.

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.