From: POSTMASTER@domain.com To: jdoe@domain.com Subject: Message Delivery Failure MailEnable: Message Delivery Failure. The following recipient(s) could not be reached: Recipient: [SMTP: bill@domain.com] Reason: The message could not be delivered because the domain name (domain.com) does not appear to be registered.
From: MAILER-DAEMON@domain.local To: jdoe@localhost Subject: Undeliverable mail: Failed to deliver to ''
// Create POP3 object
Pop3 pop = new Pop3();
// Enable logging to file
pop.Log.Enabled = true;
pop.Log.Filename = @"C:\log.txt";
pop.Log.Clear();
// Connect to POP3 server
pop.Connect("mail.domain.com");
pop.Login("bounce", "secret");
// Download headers and bodies of all messages.
MailMessageCollection msgs = pop.DownloadMessageHeaders(1, -1, -1);
// Loop through all messages in the mailbox
foreach (MailMessage msg in msgs)
{
string strLine = msg.BodyPlainText;
Console.WriteLine("From: " + msg.From.Email);
// Get failed email address
string str_invalid_email = GetInvalidEmailAddressME(msg);
// If str_invalid_email is non-empty then failed email
// address was found
if (str_invalid_email.Length > 0)
{
// Remove failed email from database
RemoveEmailFromDatabase(str_invalid_email);
// Display invalid adress
Console.WriteLine("Invalid email: " + str_invalid_email);
// Delete bounced email from server to avoid
// processing it next time
pop.DeleteMessage(msg.IndexOnServer);
}
}
// Disconnect from POP3 server
pop.Disconnect();
// The function checks whether the message is bounced and extracts
// failed address
// from bounced message. Valid only for MailEnable servers
static string GetInvalidEmailAddressME(MailMessage msg)
{
string str_invalid_email = msg.BodyPlainText;
// Check if this is a bounced message report
if (msg.Subject.IndexOf("Delivery Failure") == -1)
{
return "";
}
if (msg.From.ToString().IndexOf("POSTMASTER") == -1)
{
return "";
}
// Now we're sure this is a bounced message report
int i_start;
i_start = str_invalid_email.IndexOf("SMTP:");
// Check if bounced message report contains "Recipient:" field
if (i_start == -1)
{
return "";
}
// Get failed address
i_start += 5;
i_end = str_invalid_email.IndexOf("]",i_start);
str_invalid_email.Substring(i_start, i_end);
return str_invalid_email;
}
// The function checks whether the message is bounced and extracts
// failed address
// from bounced message. Valid only for Communigate Pro servers
static string GetInvalidEmailAddressCP(MailMessage msg)
{
string str_invalid_email = msg.BodyPlainText;
// Check if this is a bounced message report
if (msg.Subject.IndexOf("Undeliverable mail") == -1)
{
return "";
}
if (msg.From.ToString().IndexOf("MAILER-DAEMON") == -1)
{
return "";
}
// Now we're sure this is a bounced message report
int i_start;
i_start = str_invalid_email.IndexOf("to '<");
// Check if bounced message report contains
// "Failed to deliver to " field
if (i_start == -1)
{
return "";
}
// Get failed address
i_start += 5;
i_end = str_invalid_email.IndexOf("]",i_start);
str_invalid_email.Substring(i_start, i_end);
return str_invalid_email;
}
// This function must remove (or disable) specified
// email address from mailing list
static void RemoveEmailFromDatabase(string str_invalid_email)
{
// TODO: Add your code here
}Dim pop As New Pop3
' Enable logging to file
pop.Log.Enabled = True
pop.Log.Filename = "C:\log.txt"
pop.Log.Clear()
' Connect to POP3 server
pop.Connect("mail.domain.com")
pop.Login("jdoe", "secret")
' Download headers and bodies for all messages.
Dim msgs As MailMessageCollection = pop.DownloadMessageHeaders(1, -1, -1)
' Loop through all messages in the mailbox
Dim msg As MailMessage
For Each msg In msgs
Dim strLine As String = msg.BodyPlainText
Console.WriteLine("From: " + msg.From.Email)
' Get failed email address
Dim str_invalid_email As String = GetInvalidEmailAddressME(msg)
' If str_invalid_email is non-empty then failed email
' address was found
If str_invalid_email.Length > 0 Then
'Remove failed email from database
RemoveEmailFromDatabase(str_invalid_email)
' Display invalid address
Console.WriteLine("Invalid email: " & str_invalid_email)
' Delete bounced email from server to avoid
' processing it next time
pop.DeleteMessage(msg.IndexOnServer)
End If
Next
Console.ReadLine()
' Disconnect from POP3 server
pop.Disconnect()
' The function checks whether the message is bounced and extracts
' failed address
' from bounced message. Valid only for MailEnable servers
Function GetInvalidEmailAddressME(ByVal msg As MailMessage) As String
Dim str_invalid_email As String = msg.BodyPlainText
' Check if this is a bounced message report
If msg.Subject.IndexOf("Delivery Failure") = -1 Then
Return ""
End If
If msg.From.ToString().IndexOf("POSTMASTER") = -1 Then
Return ""
End If
' Now we're sure this is a bounced message report
Dim i_start As Integer, i_end As Integer
i_start = str_invalid_email.IndexOf("SMTP:")
' Check if bounced message report contains "Recipient:" field
If i_start = -1 Then
Return ""
End If
' Get failed address
i_start += 5
i_end = str_invalid_email.IndexOf("]", i_start)
str_invalid_email.Substring(i_start, i_end)
Return str_invalid_email
End Function
' The function checks whether the message is bounced and extracts
' failed address
' from bounced message. Valid only for Communigate Pro servers
Function GetInvalidEmailAddressCP(ByVal msg As MailMessage) As String
Dim str_invalid_email As String = msg.BodyPlainText
' Check if this is a bounced message report
If msg.Subject.IndexOf("Undeliverable mail") = -1 Then
Return ""
End If
If msg.From.ToString().IndexOf("MAILER-DAEMON") = -1 Then
Return ""
End If
' Now we're sure this is a bounced message report
Dim i_start As Integer, i_end As Integer
i_start = str_invalid_email.IndexOf("to '<")
' Check if bounced message report contains
' "Failed to deliver to " field
If i_start = -1 Then
Return ""
End If
' Get failed address
i_start += 5
i_end = str_invalid_email.IndexOf("]", i_start)
str_invalid_email.Substring(i_start, i_end)
Return str_invalid_email
End Function
' This function must remove (or disable) specified
' email address from mailing list
Sub RemoveEmailFromDatabase(ByVal str_invalid_email As String)
' TODO: Add your code here
End Sub
LEAD Technologies发布了LEADTOOLS v19 SDK的重大更新,本次更新侧重于文档和医疗功能,其中一些功能在商业SDK市场中是前所未有的。包括第一个完整的商业Hanging Protocol SDK解决方案、大图像(以TB为单位)支持、文档格式支持以及更新各种识别技术,包含OCR、表单、OMR、条码、信用卡读卡器和Visual Studio 2017的兼容性。
LEADTOOLS v19 (Windows、Linux、IOS/macOS、Android)下载>>>
LEAD Technologies总裁Rich Little表示:“这次更新是LEAD继续加强LEADTOOLS以解决现实问题的一个很好的例子。我们非常高兴能够拥有第一个商业医疗查看器SDK,包括完整的DICOM Hanging Protocol、优化的大图像加载和一个新的超快速表单识别算法。26年前我和Moe创建LEAD时,我们从来没有想过可以加载1TB的图像。”






试用、下载、了解更多产品信息请点击"咨询在线客服"





| Public Class Form1 Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNew.Click If Dialog1.ShowDialog() Then If Dialog1.GetChooseType() = 1 Then AxEDOffice1.CreateNew("Word.Application") ElseIf Dialog1.GetChooseType() = 2 Then AxEDOffice1.CreateNew("Excel.Application") ElseIf Dialog1.GetChooseType() = 3 Then AxEDOffice1.CreateNew("PowerPoint.Application") ElseIf Dialog1.GetChooseType() = 4 Then AxEDOffice1.CreateNew("Visio.Application") ElseIf Dialog1.GetChooseType() = 5 Then AxEDOffice1.CreateNew("MSProject.Application") End If End If End Sub Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click AxEDOffice1.OpenFileDialog() End Sub Private Sub btnSaveAs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveAs.Click AxEDOffice1.SaveFileDialog() End Sub Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click AxEDOffice1.CloseDoc() End Sub Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click AxEDOffice1.PrintDialog() End Sub Private Sub btnPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPreview.Click AxEDOffice1.PrintPreview() End Sub Private Sub btnToolbars_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnToolbars.Click If AxEDOffice1.Toolbars = True Then AxEDOffice1.Toolbars = False Else AxEDOffice1.Toolbars = True End If End Sub Private Sub btnAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAbout.Click AxEDOffice1.AboutBox() End Sub End Class |


| public void Open() { axEDOffice1.Open(sPath,“Excel.Application”); axEDOffice1.Open(sPath,“PowerPoint.Application”); axEDOffice1.Open(sPath,“Visio.Application”); axEDOffice1.Open(sPath,“MSProject.Application”); } |
Imports Microsoft.Office.Interop.Word Private Sub Automating_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)Handle Automating.Click Dim word = AxEDOffice1.GetApplication() word.Visible = True Dim doc As Document = AxEDOffice1.ActiveDocument() Dim range As Range = doc.Range range.InsertAfter(“Range1”+ vbCrLf) range.Collapse(WdCollapseDirection.wdCollapseEnd) doc.Bookmarks.Add(“MijnBookmark”,range) range.InsertAfter(“Range2”+ vbCrLf) Dim bookmark As Bookmark = doc。书签(1) range = bookmark.Range range.Text =“Bookmark”+ vbCrLf range.Font.Color = WdColor.wdColorBlue End Sub |

