Unfortunately I'm doing this work free of charge for a non-profit organization. Is there anything out there on the open source arena that's free of charge?
--
Posted 'as is'. If there are any spelling and/or grammar mistakes, they were a direct result of my fingers and brain not being synchronized or my lack of caffeine.
Mike Brearley
"Bill" <ms****@hotmail.com> wrote in message news:Oo**************@TK2MSFTNGP09.phx.gbl...
You are going to need a component that will perform the POP3 download and then parse the message. Quiksoft Corporation has the EasyMail Components that will do this for you. Below is a simple sample that will basically do what you want using their components.
http://www.quiksoft.com/emdotnet/ You will probably have to change the code a little to get the exact look of failure message you need. You can also create a template for the failure message and have the object import it and replace the tokens.
//create POP3 object
POP3.POP3 pop3Obj = new POP3.POP3();
//Message will be stored in memory
MemoryStream memoryStream = new MemoryStream();
//Connect to the POP3 mail server
pop3Obj.Connect(mailserver);
//Log onto the POP3 mail server
pop3Obj.Login(username,password,POP3.AuthMode.Plai n);
int MessageCount = pop3Obj.GetMessageCount();
int Count;
for(Count=1; Count<MessageCount+; Count++)
{
//Download the first message
pop3Obj.DownloadMessage(Count,memoryStream);
//Set to the start of the stream
memoryStream.Position=0;
//Parse the message
Parse.EmailMessage msgObj = new Parse.EmailMessage(memoryStream);
//Send failure message
string FailureSubject = "Delivery Failure:" + msgObj.Subject;
string FailureFromAddress = "po********@domain.com";
string FailureBody = "To:" + msgObj.To[0].EmailAddress + "\r\nSubject: " + msgObj.Subject + "\r\nSent:" + msgObj.Date.ToString(); //Add adition body or you can just import from a file
SMTP.SMTP.QuickSend("mail.domain.com",msgObj.From[0].EmailAddress,FailureFromAddress,
FailureSubject,FailureBody,SMTP.BodyPartFormat.Pla in);
//Close the memory stream
memoryStream.Close();
memoryStream = new MemoryStream();
//Delete Message
pop3Obj.DeleteMessage(Count);
}
//Disconnect from POP3 server
pop3Obj.Disconnect();
"Mike Brearley" <no****@spam.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl...
I need to write a script that will check a catch-all mailbox (pop3) and send
a non delivery report back to the sender of the email.
Background info:
I have a domain hosted on a site that offers unlimited email accounts... the
problem is, emails sent to an invalid address on the domain aren't
automatically returned as non-deliverable. I am, however, able to set up a
catch-all address and able to pick up those emails. Id like to set up a
script that checks that account and generates an appropriate ndr that looks
somewhat like the following:
Your message
To: em***@domain.com
Subject: test non delivery
Sent: Sun, 2 Jan 2005 20:42:39 -0500
did not reach the following recipient(s):
em***@domain.com on Sun, 2 Jan 2005 20:42:39 -0500
The e-mail account does not exist at the organization this message was
sent to. Check the e-mail address, or contact the recipient directly to
find out the correct address.
<server.domain.com #5.1.1>
And if possible, return the original message as an attachment as a normal
non delivery report would.
--
Posted 'as is'. If there are any spelling and/or grammar mistakes, they
were a direct result of my fingers and brain not being synchronized or my
lack of caffeine.
Mike Brearley