Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
christian77
Partner - Specialist
Partner - Specialist

Sendind e-mail

Hi:

I´m using this macro to send e-mails with pdf attachment. (qv community provided by)

As soon as I change the recipient to one outside the network, it stops working. (error: stops in objEmail.Send)

Function sendMailTest()

Dim objEmail

Const cdoSendUsingPort = 1 ' Send the message using SMTP

Const cdoAnonymous = 0 'Do not authenticate

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

Const cdoNTLM = 2 'NTLM

"mail.myserver.com"

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

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

' 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

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

End With

objEmail.To = "christian@myserver.com" 'Email Recipient ONLY INSIDE THE NETWORK

objEmail.From = "christian@myserver.com" 'Email Sender

objEmail.Subject = "hola"

objEmail.TextBody = "hola"

objEmail.AddAttachment "C:\temp\VITORIA.pdf" ' Attachement

objEmail.Send

Set objFlds = Nothing

Set objConf = Nothing

Set objEmail = Nothing

msgbox ("Test Mail Sent")

end function

Does anybody know how to authenticate this macro with user & password?

Thanks in advance.



1 Reply
Not applicable

hey Christian77, does your code above works fine  if you are sending mail on ths same network...i tried using this code for the id's on the same netwok,  but its not working...it doesn't give me any error when i fire this function...but my mail is not going....if can provide some help...