ActiveEmail E-mail Toolkit
Manual Pages
© 1999-2007 - ActiveXperts Software B.V.
http://www.activexperts.com
info@activexperts.com
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" ) ' Create SmtpServer object
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" ) ' Create SmtpMail object
objSmtpServer.Connect( "smtp.mydomain.com" ) ' Establish connection
If( objSmtpServer.LastError = 0 ) Then
objSmtpMail.FromAddress = "sender@mydomain.com" ' From (e-mail address)
objSmtpMail.FromName = "ActiveEmail Demo" ' From (name)
objSmtpMail.Subject = "ActiveEmail Message"
objSmtpMail.Body = "Hello, how are you?"
objSmtpMail.AddTo "frank@myrecipients.com", "Frank" ' Add a recipient
objSmtpServer.Send( objSmtpMail ) ' Send mail now
objSmtpServer.Disconnect ' Disconnect
End If
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" ) ' Create SmtpServer object
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" ) ' Create SmtpMail object
Set objConstants = CreateObject( "ActiveXperts.EMailConstants" ) ' Create constants object
objSmtpServer.Connect( "smtp.mydomain.com" ) ' Establish connection
If( objSmtpServer.LastError = 0 ) Then
objSmtpMail.FromAddress = "sender@mydomain.com" ' From (e-mail address)
objSmtpMail.FromName = "ActiveEmail Demo" ' From (name)
objSmtpMail.Subject = "ActiveEmail Message"
objSmtpMail.Priority = objConstants.asMESSAGE_PRIORITY_HIGH ' High priority
objSmtpMail.BodyType = objConstants.asMESSAGE_BODY_HTML ' RTF/HTML body format)
objSmtpMail.Body = "<b>Hello, how are you?</b><br>I'm fine"
objSmtpMail.AddTo "frank@myrecipients.com", "Frank" ' Add a recipient
objSmtpMail.AddTo "harry@myrecipients.com", "Harry" ' Add a recipient
objSmtpMail.AddCc "joseph@myrecipients.com", "Joseph" ' Add a CC recipient
objSmtpMail.AddBcc "john@myrecipients.com", "John" ' Add a BCC recipient
objSmtpServer.Send( objSmtpMail ) ' Send mail now
objSmtpServer.Disconnect ' Disconnect
End If
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" ) ' Create SmtpServer object
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" ) ' Create SmtpMail object
objSmtpServer.Connect( "smtp.mydomain.com" ) ' Establish connection
If( objSmtpServer.LastError = 0 ) Then
objSmtpMail.FromAddress = "sender@mydomain.com"
objSmtpMail.FromName = "ActiveEmail Demo"
objSmtpMail.Subject = "ActiveEmail Message"
objSmtpMail.Body = "Hello, how are you?"
objSmtpMail.AddTo "frank@myrecipients.com", "Frank"
objSmtpMail.AddAttachment ".\picture1.jpg" ' Add attachment
objSmtpMail.AddAttachment ".\picture2.jpg" ' Add anotherattachment
objSmtpServer.Send( objSmtpMail ) ' Send mail now
objSmtpServer.Disconnect ' Disconnect
End If
Set objPop3Server = CreateObject ( "ActiveXperts.Pop3Server" ) ' Create Pop3Server object
objPop3Server.Connect "pop3.mydomain.com", "acc", "passwd" ' Connect to server, login using POP3 account 'acc'
If( objPop3Server.LastError = 0 ) Then
numMessages = objPop3Server.CountMessages()
For i = 1 to numMessages ' Iterate over all POP3 messages
Set objPop3Mail = objPop3Server.GetEmailHeader( i )
If ( objPop3Server.LastError = 0 ) Then
WScript.Echo "MessageID : " & objPop3Mail.ID
WScript.Echo " FromAddress : " & objPop3Mail.FromAddress
WScript.Echo " FromName : " & objPop3Mail.FromName
WScript.Echo " To : " & objPop3Mail.ToAddress
WScript.Echo " Subject : " & objPop3Mail.Subject
WScript.Echo " Date : " & objPop3Mail.Date
WScript.Echo vbCrLf
End If
Next
objSmtpServer.Disconnect ' Disconnect
End If
Set objPop3Server = CreateObject ( "ActiveXperts.Pop3Server" ) ' Create Pop3Server object
objPop3Server.Connect "pop3.mydomain.com", "acc", "passwd" ' Connect to server, login using POP3 account 'acc'
If( objPop3Server.LastError = 0 ) Then
numMessageID = CInt( inputbox( "1", "Enter message ID (1 <= Message ID <= Count" )
Set objPop3Mail = objPop3Server.GetEmail ( numMessageID )
If( objPop3Server.LastError = 0 ) Then
WScript.Echo "MessageID : " & objPop3Mail.ID
WScript.Echo " From : " & objPop3Mail.FromAddress
WScript.Echo " To : " & objPop3Mail.ToAddress
WScript.Echo " Cc : " & objPop3Mail.CcAddress
WScript.Echo " Reply Address : " & objPop3Mail.ReplyAddress
WScript.Echo " Subject : " & objPop3Mail.Subject
WScript.Echo " Priority : " & objPop3Mail.Priority
WScript.Echo " Date : " & objPop3Mail.Date
WScript.Echo " Hash : " & objPop3Mail.Hash
WScript.Echo " Header : " & Left ( objPop3Mail.Header, InStr ( objPop3Mail.Header, vbCrLf ) )
WScript.Echo " Body : " & Left ( objPop3Mail.Body, InStr ( objPop3Mail.Body, vbCrLf ) )
WScript.Echo " Attachments : " & objPop3Mail.CountAttachments & vbCrLf
numAttachments = objPop3Mail.CountAttachments
For i = 1 to numAttachments ' Iterate over all attachments
WScript.Echo "Attachment : " & objPop3Mail.GetAttachment ( i )
Next
End If
objSmtpServer.Disconnect ' Disconnect
End If
Dim objConstants As AEMAILLib.EMailConstants ' Declaration objConstants = New AEMAILLib.EMailConstants() ' Creation
Dim objSmtpServer As AEMAILLib.SmtpServer ' Declaration objSmtpServer = New AEMAILLib.SmtpServer() ' Creation
Dim objSmtpMail As AEMAILLib.SmtpMail ' Declaration objSmtpMail = New AEMAILLib.SmtpMail() ' Creation
Dim objPop3Server As AEMAILLib.Pop3Server ' Declaration objPop3Server = New AEMAILLib.Pop3Server() ' Creation
Dim objPop3Mail As AEMAILLib.Pop3Mail ' Declaration objPop3Mail = New AEMAILLib.Pop3Mail() ' Creation
using AEMAILLib; ... EmailConstants objConstants = new EmailConstants() ' Declaration and Creation
using AEMAILLib; ... SmtpServer objSmtpServer = new SmtpServer() ' Declaration and Creation
using AEMAILLib; ... SmtpMail objSmtpMail = new SmtpMail() ' Declaration and Creation
using AEMAILLib; ... Pop3Server objPop3Server = new Pop3Server() ' Declaration and Creation
using AEMAILLib; ... Pop3Mail objPop3Mail = new Pop3Mail() ' Declaration and Creation
Dim objConstants As AEMAILLib.EmailConstants ' Declaration Set objConstants = CreateObject( "ActiveXperts.EmailConstants" ) ' Creation
Dim objSmtpServer As AEMAILLib.SmtpServer ' Declaration Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" ) ' Creation
Dim objSmtpMail As AEMAILLib.SmtpMail ' Declaration Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" ) ' Creation
Dim objPop3Server As AEMAILLib.Pop3Server ' Declaration Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" ) ' Creation
Dim objPop3Mail As AEMAILLib.Pop3Mail ' Declaration Set objPop3Mail = CreateObject( "ActiveXperts.Pop3Mail" ) ' Creation
IEMailConstants *pConstants = NULL; ' Declaration
CoCreateInstance(CLSID_EMailConstants, NULL, CLSCTX_INPROC_SERVER, IID_IEMailConstants, (void**) &pConstants);
' Creation
ISmtpServer *pSmtpServer = NULL; ' Declaration
CoCreateInstance(CLSID_SmtpServer, NULL, CLSCTX_INPROC_SERVER, IID_ISmtpServer, (void**) &pSmtpServer);
' Creation
ISmtpMail *pSmtpMail = NULL; ' Declaration
CoCreateInstance(CLSID_SmtpMail, NULL, CLSCTX_INPROC_SERVER, IID_ISmtpMail, (void**) &pSmtpMail);
' Creation
IPop3Server *pPop3Server = NULL; ' Declaration
CoCreateInstance(CLSID_Pop3Server, NULL, CLSCTX_INPROC_SERVER, IID_IPop3Server, (void**) &pPop3Server);
' Creation
IPop3Mail *pPop3Mail = NULL; ' Declaration
CoCreateInstance(CLSID_Pop3Mail, NULL, CLSCTX_INPROC_SERVER, IID_IPop3Mail, (void**) &pPop3Mail);
' Creation
EMailConstants : TConstants; ' Declaration of the wrapper class objConstants : IConstants; ' Declaration of the interface class objConstants := EMailConstants.DefaultInterface; ' Creation new instance of the objectDeclare and create a new SmtpServer object in the following way:
SmtpServer : TSmtpServer; ' Declaration of the wrapper class objSmtpServer : ISmtpServer; ' Declaration of the interface class objSmtpServer := SmtpServer.DefaultInterface; ' Creation new instance of the objectDeclare and create a new SmtpMail object in the following way:
SmtpMail : TSmtpMail; ' Declaration of the wrapper class objSmtpMail : ISmtpMail; ' Declaration of the interface class objSmtpMail := SmtpMail.DefaultInterface; ' Creation new instance of the objectDeclare and create a new Pop3Server object in the following way:
Pop3Server : TPop3Server; ' Declaration of the wrapper class objPop3Server : IPop3Server; ' Declaration of the interface class objPop3Server := Pop3Server.DefaultInterface; ' Creation new instance of the objectDeclare and create a new Pop3Mail object in the following way:
Pop3Mail : TPop3Mail; ' Declaration of the wrapper class objPop3Mail : IPop3Mail; ' Declaration of the interface class objPop3Mail := Pop3Mail.DefaultInterface; ' Creation new instance of the object
<html>
<body>
Version:
<script language=vbscript runat=server>
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )
Response.Write objSmtpServer.Version
</script>
</body>
</html>
Visual Basic .NET samples are installed as part of the product, but can also be found on the ActiveXperts web site.
<html>
<body>
Version:
<%
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer )
Response.Write objSmtpServer.Version
%>
</body>
</html>
Set objConstants = CreateObject( "ActiveXperts.EMailConstants" ) WScript.Echo objConstants.asMESSAGE_BODY_PLAIN WScript.Echo objConstants.asMESSAGE_BODY_HTML ...
|
|
|
|
|
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" ) ' Create SmtpServer object
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" ) ' Create SmtpMail object
objSmtpServer.Connect( "smtp.mydomain.com" ) ' Establish connection
If( objSmtpServer.LastError = 0 ) Then
objSmtpMail.FromAddress = "sender@mydomain.com" ' From (e-mail address)
objSmtpMail.FromName = "ActiveEmail Demo" ' From (name)
objSmtpMail.Subject = "ActiveEmail Message" ' Subject
objSmtpMail.Body = "Hello, how are you?" ' Body
objSmtpMail.AddTo "frank@myrecipients.com", "Frank" ' Add a recipient
objSmtpServer.Send( objSmtpMail ) ' Send mail now
objSmtpServer.Disconnect ' Disconnect
End If
|
|
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" ) ' Create SmtpServer object
...
WScript.Echo "Version: " & objSmtpServer.Version
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" ) ' Create SmtpServer object
...
WScript.Echo "ExpirationDate: " & objSmtpServer.ExpirationDate
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" ) ' Create SmtpServer object
...
objSmtpServer.LogFile = "c:\smtp.log" ' Specify log file
objSmtpServer.Connect( "smtp.mydomain.com" )
If( objSmtpServer.LastError = 0 )
...
objSmtpServer.Disconnect()
End If
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )
...
objSmtpServer.HostPort = 7025 ' To specify an alternate port other than 25
objSmtpServer.Connect( "smtp.myserver.com" ) ' Attempt to connect on port 7025
...
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )
Set objConstants = CreateObject( "ActiveXperts.EMailConstants" )
...
objSmtpServer.Authentication = objConstants.asAUTH_SMTP_MD5CRAM
objSmtpServer.Connect( "smtp.myserver.com", "userid", "passwd" ) ' Connect and authenticate using MD5/CRAM
...
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )
...
objSmtpServer.Send
WScript.Echo "Result code: " & objSmtpServer.LastError
WScript.Echo "Result description: " & objSmtpServer.GetErrorDescription( objSmtpServer.LastError )
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )
...
objSmtpServer.Send
WScript.Echo "LastError: " & objSmtpServer.LastError
WScript.Echo "Response of SMTP Server: " & objSmtp.LastSmtpResponse
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )
objSmtpServer.Activate "xxxxx-xxxxx-xxxxx" ' replace xxxxx-xxxxx-xxxxx by your personal registration code
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )
objSmtpServer.Connect( "smtp.thisdomaindoesnotexist.com" )
WScript.Echo objSmtpServer.LastError
objSmtpServer.Clear()
WScript.Echo objSmtpServer.LastError
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
objSmtpServer.Connect( "smtp.domainname.com" )
If( objSmtpServer.LastError = 0 ) Then
objSmtpMail.From = "me@mydomain.com"
objSmtpMail.Subject = "This is my subject"
...
objSmtpServer.Send
objSmtpServer.Disconnect
End If
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
objSmtpServer.Connect( "exchange.domainname.com", "administrator", "mypassword" )
If( objSmtpServer.LastError = 0 ) Then
objSmtpMail.From = "me@mydomain.com"
objSmtpMail.Subject = "This is my subject"
...
objSmtpServer.Send
objSmtpServer.Disconnect
End If
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )
objSmtpServer.Connect( "smtp.domainname.com" )
If( objSmtpServer.LastError = 0 ) Then
...
objSmtp.Disconnect
End If
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )
objSmtpServer.Connect( "smtp.domainname.com" )
WScript.Echo objSmtpServer.LastError
If( objSmtpServer.IsConnected() Then )
WScript.Echo "Connected!"
Else
WScript.Echo "Not connected"
End If
...
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
objSmtpServer.Connect( "smtp.domainname.com" )
If( objSmtpServer.LastError = 0 ) Then
objSmtpMail.From = "me@mydomain.com"
objSmtpMail.AddTo "john@company.com", "My Friend John"
objSmtpMail.Subject = "This is my subject"
...
objSmtpServer.Send( objSmtpMail )
objSmtpServer.Disconnect
End If
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
...
objSmtpMail.From = "me@mydomain.com"
objSmtpMail.AddTo "john@company.com", "My Friend John"
objSmtpMail.Subject = "This is my subject"
...
objSmtpServer.Queue( "smtp.domainname.com", objSmtpMail )
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )
objSmtpServer.Connect( "smtp.domainname.com" )
If( objSmtpServer.LastError = 0 ) Then
...
objSmtpServer.Disconnect
Else
WScript.Echo "Error description: " & objSmtpServer.GetErrorDescription( objSmtpServer.LastError )
End If
' Create a new SmtpMail object; assign values to properties
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
objSmtpMail.FromAddress = "sender@mydomain.com" ' From (e-mail address)
objSmtpMail.FromName = "ActiveEmail Demo" ' From (name)
objSmtpMail.Subject = "ActiveEmail Message" ' Subject
objSmtpMail.Body = "Hello, how are you?" ' Body
objSmtpMail.AddTo "frank@myrecipients.com", "Frank" ' Add a recipient
' Create a new SmtpServer object; connect to the mail server
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" ) ' Create SmtpServer object
objSmtpServer.Connect( "smtp.mydomain.com" ) ' Establish connection
If( objSmtpServer.LastError <> 0 ) Then
WScript.Quit
End If
' Send the message
objSmtpServer.Send( objSmtpMail ) ' Send mail now
objSmtpServer.Disconnect ' Disconnect
|
|
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
...
objSmtpMail.From = "me@mydomain.doc"
objSmtpMail.FromName = "This is Me"
...
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
...
objSmtpMail.Organization = "My Organization"
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
...
objSmtpMail.ReplyAddress = "myself@mydomain.com"
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
...
objSmtpMail.ReadReceiptAddress = "myself@mydomain.com"
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
Set objConstants = CreateObject( "ActiveXperts.EMailConstants" )
...
objSmtpMail.Encoding = objConstants.asMESSAGE_ENCODING_JAPANESE ' Message will be encoded as Japanese text
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" ) ... objSmtpMail.Subject = "This is an important message"
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
Set objConstants = CreateObject( "ActiveXperts.EMailConstants" )
...
objSmtpMail.Priority = objConstants.asPRIORITYHIGH ' High priority
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
...
' Default body format: plain text, so no need to change objSmtpMail.BodyType
objSmtpMail.Body = "This is my body message." & vbCrLf & "Best regards."
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
Set objConstants = CreateObject( "ActiveXperts.EMailConstants" ) ' Create constants object
...
objSmtpMail.BodyType = objConstants.asMESSAGE_BODY_HTML
objSmtpMail.Body = "<html><body>This is my <i>body message</i>.<br>Regards.</body></html>"
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
Set objConstants = CreateObject( "ActiveXperts.EMailConstants" ) ' Create constants object
...
objSmtpMail.AddAttachment "C:\MySelf.jpg"
objSmtpMail.AddAttachment "C:\MyWife.jpg"
objSmtpMail.BodyType = objConstants.asMESSAGE_BODY_HTML
objSmtpMail.Body = "<html><body>This <SRC="01"> is me <br>and <SRC="02" my wife<br></body></html>
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
...
objSmtpMail.AddAttachment( "C:\File.txt" )
WScript.Echo "Result code: " & objSmtpMail.LastError
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" ) ' Create SmtpServer object
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
objSmtpServer.Connect( "smtp.domainname.com" )
If( objSmtpServer.LastError = 0 ) Then
objSmtpMail.From = "me@mydomain.com"
objSmtpMail.AddTo "john@company.com", "My Friend John"
objSmtpMail.Subject = "This is my subject"
objSmtpMail.Body = "This is my message to you"
objSmtpServer.Send( objSmtpMail )
objSmtpMail.Clear ' Clear mail properties
objSmtpMail.From = "me@mydomain.com"
objSmtpMail.AddTo "michael@company.com", "My Friend Michael"
objSmtpMail.Subject = "This is my subject"
objSmtpMail.Body = "This is my message to you"
objSmtpServer.Send( objSmtpMail )
objSmtpServer.Disconnect
End If
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
objSmtpMail.AddTo "roger@thecompany.com", "My friend Roger"
objSmtpMail.AddTo "mike@thecompany.com", ""
objSmtpMail.AddCc "dennis@thecompany.com", "My friend Dennis"
objSmtpMail.AddBcc "jim@thecompany.com", ""
objSmtpMail.AddBcc "joe@thecompany.com", "My friend Joe"
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
objSmtpMail.AddAttachment "c:\temp\mypicture.jpg"
objSmtpMail.AddAttachment "c:\temp\mydocument.doc"
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )
objSmtpMail.LoadMIME( "C:\File.mim" )
WScript.Echo "LoadMIME, result: " & objSmtpMail.LastError
...
objSmtpServer.Connect( "mailserver.company.intra" )
objSmtpServer.Send( objSmtpMail )
objSmtpServer.Disconnect()
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
objSmtpMail.From = "me@mydomain.com"
objSmtpMail.AddTo "john@company.com", "My Friend John"
objSmtpMail.Subject = "This is my subject"
objSmtpMail.Body = "This is my message to you"
objSmtpMail.AddAttachment "c:\temp\mypicture.jpg"
objSmtpMail.AddAttachment "c:\temp\mydocument.doc"
objSmtpMail.SaveMIME( "C:\File.mim" )
WScript.Echo "SaveMIME, result: " & objSmtpMail.LastError
Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" ) ' Create Pop3Server object
objPop3Server.Connect( "pop3.mydomain.com", "userid", "passwd" ) ' Connect to the POP3 server, and login using
' account 'userid', password 'passwd'
If( objPop3Server.LastError = 0 ) Then
numMessages = objPop3Server.CountMessages() ' Count the messages in the mailbox
WScript.Echo numMessages & " new message(s) in mailbox."
For i = 1 to 3 ' Iterate over the first 3 messages in the mailbox
Set objPop3Mail = objPop3Server.GetEmail( i ) ' Get e-mail
If ( objPop3Server.LastError = 0 ) Then ' If message does exist then show details
WScript.Echo "MessageID : " & objPop3Mail.ID ' Show e-mail information
WScript.Echo " Size : " & objPop3Mail.Size
WScript.Echo " FromAddress : " & objPop3Mail.FromAddress
WScript.Echo " FromName : " & objPop3Mail.FromName
WScript.Echo " Organization : " & objPop3Mail.Organization
WScript.Echo " Reply Address : " & objPop3Mail.ReplyAddress
WScript.Echo " Read Receipt Address : " & objPop3Mail.ReadReceiptAddress
WScript.Echo " ToAddress : " & objPop3Mail.ToAddress
WScript.Echo " CcAddress : " & objPop3Mail.CcAddress
WScript.Echo " Priority : " & objPop3Mail.Priority
WScript.Echo " Date : " & objPop3Mail.Date
WScript.Echo " Subject : " & objPop3Mail.Subject
WScript.Echo " BodyType : " & objPop3Mail.BodyType
WScript.Echo " Body : " & Left ( objPop3Mail.Body, InStr ( objPop3Mail.Body, vbCrLf ) )
WScript.Echo " Attachments : " & objPop3Mail.CountAttachments & vbCrLf
numAttachments = objPop3Mail.CountAttachments
For i = 1 to numAttachments ' Iterate over all attachments
WScript.Echo "Attachment Name : " & objPop3Mail.GetAttachmentName(i)
WScript.Echo "Attachment Size : " & objPop3Mail.GetAttachmentSize(i)
' NOTE: attachments can be saved using the 'SaveAttachment' function
Next
End If
Next
objPop3Server.Disconnect ' Disconnect
End If
Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" ) ' Create Pop3Server object
objPop3Server.Connect( "pop3.mydomain.com", "userid", "passwd" ) ' Connect to the POP3 server, and login using
' account 'userid', password 'passwd'
If( objPop3Server.LastError = 0 ) Then
numMessages = objPop3Server.CountMessages() ' Count the messages in the mailbox
WScript.Echo numMessages & " new message(s) in mailbox."
For i = 1 to numMessages ' Iterate over all messages in the mailbox
Set objPop3Mail = objPop3Server.GetEmailHeader( i ) ' Get the header of the particular e-mail
If ( objPop3Server.LastError = 0 ) Then
WScript.Echo "MessageID : " & objPop3Mail.ID ' Show header information
WScript.Echo " Size : " & objPop3Mail.Size
WScript.Echo " FromAddress : " & objPop3Mail.FromAddress
WScript.Echo " FromName : " & objPop3Mail.FromName
WScript.Echo " Organization : " & objPop3Mail.Organization
WScript.Echo " Reply Address : " & objPop3Mail.ReplyAddress
WScript.Echo " Read Receipt Address : " & objPop3Mail.ReadReceiptAddress
WScript.Echo " ToAddress : " & objPop3Mail.ToAddress
WScript.Echo " CcAddress : " & objPop3Mail.CcAddress
WScript.Echo " Priority : " & objPop3Mail.Priority
WScript.Echo " Date : " & objPop3Mail.Date
WScript.Echo " Subject : " & objPop3Mail.Subject
WScript.Echo " BodyType : " & objPop3Mail.BodyType
' To retrieve the Body and the Attachments, use 'GetEmailMessage'
End If
Next
objPop3Server.Disconnect ' Disconnect
End If
|
|
Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" ) ' Create Pop3Server object
...
WScript.Echo "Version: " & objPop3Server.Version
Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" ) ' Create Pop3Server object
...
WScript.Echo "ExpirationDate: " & objPop3Server.ExpirationDate
Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" ) ' Create Pop3Server object
...
objPop3Server.LogFile = "c:\smtp.log" ' Specify log file
objPop3Server.Connect( "pop3.mydomain.com", "userid", "passwd" )
If( objPop3Server.LastError = 0 )
...
objPop3Server.Disconnect()
End If
Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" )
...
objPop3Server.HostPort = 8110 ' To specify an alternate port other than 110
objPop3Server.Connect( "pop3.mydomain.com", "userid", "passwd" ) ' Attempt to connect on port 8110
...
Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" )
Set objConstants = CreateObject( "ActiveXperts.EMailConstants" )
...
objPop3Server.Authentication = objConstants.asAUTH_POP3_APOP
objPop3Server.Connect( "pop3.myserver.com", "userid", "passwd" ) ' Connect and authenticate using APOP
...
Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" )
...
objPop3Server.Timeout = 300 ' Use a timeout of 5 minutes
...
Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" )
...
objPop3Server.GetEmailHeader( 1 )
WScript.Echo "Result code: " & objPop3Server.LastError
WScript.Echo "Result description: " & objPop3Server.GetErrorDescription( objPop3Server.LastError )
Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" ) ... objPop3Server.GetEmailHeader( 1 ) WScript.Echo "Result code: " & objPop3Server.LastError WScript.Echo "Last POP3 response: " & objPop3Server.LastPop3Response
Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" )
objPop3Server.Activate "xxxxx-xxxxx-xxxxx" ' replace xxxxx-xxxxx-xxxxx by your personal registration code
Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" )
objPop3Server.Connect( "pop3.mydomain.com", "userid", "passwd" )
WScript.Echo objPop3Server.LastError
objPop3Server.Clear()
WScript.Echo objPop3Server.LastError
Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" )
objPop3Server.Connect( "pop3.mydomain.com", "userid", "passwd" ) ' Connect to the POP3 server, and login using
' account 'userid', password 'passwd'
If( objPop3Server.LastError = 0 ) Then
numMessages = objPop3Server.CountMessages() ' Count the messages in the mailbox
WScript.Echo numMessages & " new message(s) in mailbox."
objPop3Server.Disconnect ' Disconnect
End If
Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" )
objPop3Server.Connect( "pop3.mydomain.com", "userid", "passwd" )
If( objPop3Server.LastError = 0 ) Then
...
objPop3.Disconnect ' Disconnect
End If
Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" )
objPop3Server.Connect( "pop3.mydomain.com", "userid", "passwd" )
WScript.Echo objPop3Server.LastError
If( objPop3Server.IsConnected() Then )
WScript.Echo "Connected!"
Else
WScript.Echo "Not connected"
End If
...
Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" )
objPop3Server.Connect( "pop3.mydomain.com", "userid", "passwd" )
If( objPop3Server.LastError = 0 ) Then
numMessages = objPop3Server.CountMessages() ' Count the messages in the mailbox
WScript.Echo numMessages & " new message(s) in mailbox."
objPop3Server.Disconnect
End If
Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" )
objPop3Server.Connect( "pop3.mydomain.com", "userid", "passwd" )
If( objPop3Server.LastError = 0 ) Then
If( objPop3Server.CountMessages() > 0 ) Then
Set objPop3Mail = objPop3Server.GetEmailHeader( 1 ) ' Get header of the e-mail (ID:1)
If ( objPop3Server.LastError = 0 ) Then
WScript.Echo "MessageID : " & objPop3Mail.ID ' Show header information
WScript.Echo " Size : " & objPop3Mail.Size
WScript.Echo " FromAddress : " & objPop3Mail.FromAddress
WScript.Echo " FromName : " & objPop3Mail.FromName
WScript.Echo " Organization : " & objPop3Mail.Organization
WScript.Echo " Reply Address : " & objPop3Mail.ReplyAddress
WScript.Echo " Read Receipt Address : " & objPop3Mail.ReadReceiptAddress
WScript.Echo " ToAddress : " & objPop3Mail.ToAddress
WScript.Echo " CcAddress : " & objPop3Mail.CcAddress
WScript.Echo " Priority : " & objPop3Mail.Priority
WScript.Echo " Date : " & objPop3Mail.Date
WScript.Echo " Subject : " & objPop3Mail.Subject
WScript.Echo " BodyType : " & objPop3Mail.BodyType