send mail using pickup

  • Thread starter Thread starter Dean
  • Start date Start date
D

Dean

I am using MailMessage (CDOSYS) to send emails. I would like to turn off the
SMTP service (it's on the local machine) and look at the emails in the
pickup folder before they get sent out. However, since it is connecting
using the port, I will get an error if I turn off the SMTP service. I need
to configure it so that it writes the emails to the pickup folder.

I've done quite a bit of digging, and found some references to
CdoSendUsing.cdoSendUsingPickup
but couldn't get it work. Maybe I don't have the right include/using
directives.

Anyone have experience using the pickup folder with C#.NET? Can I configure
this with MailMessage? Or do I have to use CDOSYS directly?
 
Hi Dean - i've been working with CDO pickup for over a year now, it's
certainly got its advantages. You can shut down SMTP temporarily, let the
messages bank up in the pickup dir, then turn it on later and they'll get
sent.

Here is some sample C# code:

CDO.Message oMsg = new CDO.MessageClass();

//populate all your normal properties

CDO.Configuration oConfig = new CDO.ConfigurationClass();
ADODB.Fields oFields = oConfig.Fields;
oFields["http://schemas.microsoft.com/cdo/configuration/sendusing"].Value =
CDO.CdoSendUsing.cdoSendUsingPickup
oFields["http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory"].Value = "c:\\inetpub\\mailroot\\pickup";
oFields.Update();

oMsg.Configuration = oConfig;

//optional - my project I have to track size of emails sent
ADODB.Stream oStream = oMsg.GetStream();
nBytesTransmitted = oStream.Size;
oStream.Close();

oMsg.Send();

Hope this helps.
 
Back
Top