Forwarding message
Dim objPOP3, objSMTP, objMsg ' Create POP3 mailer component Set objPOP3 = CreateObject("MailBee.POP3") ' Create SMTP mailer component Set objSMTP = CreateObject("MailBee.SMTP") ' Unlock POP3 component objPOP3.LicenseKey = "put your license key here" ' Unlock SMTP component objSMTP.LicenseKey = "put your license key here" ' Specify name of SMTP server to resend e-mail to objSMTP.ServerName = "smtp.server.com" ' Connect to POP3 server and log in e-mail account If objPOP3.Connect("mail.domain1.com", 110, "user", "password") Then ' If the mailbox contains some messages, If objPOP3.MessageCount > 0 Then ' then grab the first e-mail. Set objMsg = objPOP3.RetrieveSingleMessage(1) ' Any errors? If objPOP3.IsError Then ' Notify user on e-mail retrieval error MsgBox "Error #" & objPOP3.ErrCode & ", " & objPOP3.ErrDesc Else ' Replace recipients with forwarded recipient objMsg.ToAddr = "bill@host.com" ' Do not send to original CC's objMsg.CCAddr = "" ' Alter "Subject:" field objMsg.Subject = "FW: " & objMsg.Subject ' Tell SMTP component which message to send Set objSMTP.Message = objMsg ' Try to send e-mail If Not objSMTP.Send Then ' Notify user on send error MsgBox "Error #" & objSMTP.ErrCode & ", " & objSMTP.ErrDesc End If End If End If ' Although POP3 and SMTP objects automatically ' disconnect on object destruction, it's recommended ' to disconnect manually to free memory & resources ' as soon as they are no longer needed. If objSMTP.Connected Then objSMTP.Disconnect objPOP3.Disconnect Else ' Notify user on POP3 connection error MsgBox "Error #" & objPOP3.ErrCode & ", " & objPOP3.ErrDesc End If
<% Dim objPOP3, objSMTP, objMsg ' Create POP3 mailer component Set objPOP3 = CreateObject("MailBee.POP3") ' Create SMTP mailer component Set objSMTP = CreateObject("MailBee.SMTP") ' Unlock POP3 component objPOP3.LicenseKey = "put your license key here" ' Unlock SMTP component objSMTP.LicenseKey = "put your license key here" ' Specify name of SMTP server to resend e-mail to objSMTP.ServerName = "smtp.server.com" ' Connect to POP3 server and log in e-mail account If objPOP3.Connect("mail.domain1.com", 110, "user", "password") Then ' If the mailbox contains some messages, If objPOP3.MessageCount > 0 Then ' then grab the first e-mail. Set objMsg = objPOP3.RetrieveSingleMessage(1) ' Any errors? If objPOP3.IsError Then ' Notify user on e-mail retrieval error Response.Write "Error #" & objPOP3.ErrCode & ", " & objPOP3.ErrDesc Else ' Replace recipients with forwarded recipient objMsg.ToAddr = "bill@host.com" ' Do not send to original CC's objMsg.CCAddr = "" ' Alter "Subject:" field objMsg.Subject = "FW: " & objMsg.Subject ' Tell SMTP component which message to send Set objSMTP.Message = objMsg ' Try to send e-mail If Not objSMTP.Send Then ' Notify user on send error Response.Write "Error #" & objSMTP.ErrCode & ", " & objSMTP.ErrDesc End If End If End If ' Although POP3 and SMTP objects automatically ' disconnect on object destruction, it's recommended ' to disconnect manually to free memory & resources ' as soon as they are no longer needed. If objSMTP.Connected Then objSMTP.Disconnect objPOP3.Disconnect Else ' Notify user on POP3 connection error Response.Write "Error #" & objPOP3.ErrCode & ", " & objPOP3.ErrDesc End If %>See Also: