If you use IMail, aspNetEmailprovides the native capability to write emails directly to the Spool directory.
Note: Because Queuing is an advanced feature of aspNetEmail, it is highly recommended you
test sending email using the standard Send() methods, BEFORE using the queuing methods. This allows for easier troubleshooting.
When IMail creates emails, it segments them out into multiple files, and places those files in a default directory called C:\IMail\spool. aspNetEmailnow provides the capability to natively write to the spool directory, and allow IMail to process them. aspNetEmailprovides the following properties and methods to write emails directly to the IMail spool directory.
NOTE: In order to write emails to file system, the account using aspNetEmailmust have write permissions to that directory.
[Property]
EmailMessage. IMailSpoolDirectory
This property allows you to manually specify the location of the IMail Spool directory.
[Method]
EmailMessage. SendToIMailQueue()
Sends an email directly to the Spool directory. If the directory is not specified, aspNetEmailwill scan the system and attempt to locate the directory.
[Method]
EmailMessage. SendMailMergeToIMailQueue()
This method is similar to SendMailMerge(), except that it will perform a mail merge, and send the resulting emails to the spool directory.
Both these methods have multiple overloads to accept a parameter called SpoolDirectoryPath to manually specify the spool Directory.
Here are some simple code examples using SendToIMailQueue()
[C#]
EmailMessage msg = new EmailMessage(); msg.FromAddress = "bob@mycompany.com"; msg.To="dave@mycompany.com"; msg.Subject = "this email was sent by writing to the imail spool directory."; msg.Body = "the email body goes here"; msg.SendToIMailQueue( );
[VB.NET]
Dim msg As New EmailMessage() msg.FromAddress = "bob@mycompany.com" msg.To = "dave@mycompany.com" msg.Subject = "this email was sent by writing to the imail spool directory." msg.Body = "the email body goes here" msg.SendToIMailQueue( )
The IMail queuing service works on a timer. Every so-often, when this timer fires, IMail will scan the spool directory and process any emails placed there. Thus, email dropped in the spool directory are not immediately sent, and may take some time before the send starts. This timer value can be changed in the IMail Administration interface. Currently, the lowest interval allowed is 10 minutes. The administration interface also allows the administrator to manually start the send process.
For more information regarding IMail’s queuing process, please visit
IMail’s support site at http://support.ipswitch.com/kb/
Or directly to any queue articles at
Queuing Support Articles
aspNetEmailperforms a number of steps to locate the IMail spool directory. Here is an explanation of these steps, to help you optimize your use of aspNetEmail.
<appSettings>
<add key="aspNetEmail.IMailSpoolDirectory" value="C:\temp\imailspool2"></add>
</appSettings>
If none of these values can be found, or do not exist, an exception will be thrown.
Note: IMail is a registered trademark of IPswitch.