Use both send and pickup directory method for SMTP mailSetting

360 views Asked by At

Current system that I working on has a email sending function with this configuration in Web.config as below

<mailSettings>
    <!-- Method#1: Configure smtp server credentials -->
    <smtp from="[email protected]">
        <network enableSsl="true" host="smtp.gmail.com" port="587" userName="[email protected]" password="valid-password" />
    </smtp>
    <!-- Method#2: Dump emails to a local directory -->
    <smtp from="[email protected]" deliveryMethod="SpecifiedPickupDirectory">
        <network host="localhost" />
        <specifiedPickupDirectory pickupDirectoryLocation="~/App_Data/EmailPickup" />
    </smtp>
</mailSettings>

As the config shown about there is 2 method, but it only able to enable 1 method in a time, else it will cause error when i try to run the system.

Question: it there any config or setting can make both of the method work at the same time? I want it send the email as well as pickup the email and drop it into the folder i specific on.

I was able to manually create a file with StreamWriter and save into folder but it require extra code to handle it.

0

There are 0 answers