Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi everyone,
I am looking for macro to send e-mail on daily basis from my qlikview document.
welcome all suggestion
Thanks in advance.
Hi,
Try this
Sub SendMail(toMailID, attachmentPath)
Dim objEmail
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 = "199.199.199.199" Your SMTP Server
Const SMTPPort = 25 ' Port number for SMTP
Const SMTPTimeout = 60 ' Timeout for SMTP in seconds
'Sending 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
objEmail.To = toMailID 'Email Recipient
objEmail.From = "yourMail@gmail" 'Email Sender
objEmail.Subject = "**Subject**" ' Subject
'objEmail.TextBody = "some text in the body of the mail" 'Text Body
objEmail.AddAttachment attachmentPath ' Attachement
objEmail.Send
Set objFlds = Nothing
Set objConf = Nothing
Set objEmail = Nothing
End Sub
password authentication is not required in this?
SMTP server and port no. is of sender or recipient?
Hi vijit,
SMTP server and port no of Sender only.