| || |
Reading Email without outlook.application object
Is there a way that i can read a outlook email without the outllok API.Like for sending email we can use CDO.
My issue is, when im running in a VM & if that particular machine doesnt have the outllok installed.
Will the code with outllok.application object work??
Use an IMAP library. It's a standard email protocol, and there's just about an APi in almost any popular language for connecting with that protocol
Originally Posted by Hyd_kool
BTW, it's a common practice to package your automated tests with a VM snapshot they run on for native application tests. This will ensure a clean consistent environment. That can ensure the setup is consistent.
However, you want to avoid using outlook anyways. It's a 3rd party app, you want to avoid as many 3rd party apps as possible. Using an IMAP api, is just a code dependency which you can check in with your source code.
The following code is not working for the CDO message while sending mail.
Error messga is coming as :
The server rejected one or more recipient address.The server response was 5220.127.116.11 .Unable to relay for firstname.lastname@example.org
Line 39 char 1
Below is my Code
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "train on"&" "&Date&" at "&Time
objMessage.From = "email@example.com"
objMessage.To = "firstname.lastname@example.org"
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
'Open the file for reading
Set f = fso.OpenTextFile("C:\Health.rtf", ForReading)
'The ReadAll method reads the entire file into the variable BodyText
BodyText = f.ReadAll
'Close the file
Set f = Nothing
Set fso = Nothing
objMessage.TextBody = BodyText
'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "10.10.14.15"
'Server port (typically 25)
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'==End remote SMTP server configuration section==
'objMessage.Cc = ""
Can you please help me out to fix the issue and send me the mail to email@example.com