5 Replies Latest reply on Jan 12, 2009 12:46 AM by Fetch

    Log email text

    Torgom
      Hello.

      Is it possible to capture the text of the email in mailsent.log?

      Thank you,
        • 1. Re: Log email text
          Level 7
          Torgom wrote:
          > Hello.
          >
          > Is it possible to capture the text of the email in mailsent.log?

          I don't think there's a way to do that from ColdFusion. The means to do
          that will depends on your environment (OS, mail server, etc).

          --
          Mack
          • 2. Re: Log email text
            Torgom Level 1
            Mack,

            Do you know how to do that?

            Thanks for the reply
            • 3. Re: Log email text
              Fetch Level 1
              There is no way to include the full body of the email message in the mailsent.log file; that only logs the datetime, subject, to/from, plus a status message and some other cf-related info.

              So, what Mack was saying that is if CF won't do it natively you need to 'intercept' and copy the message at some other stage of the game. Two ways occur to me

              1. You can add code to your CF app that sends a duplicate message to another email address of your choice (i.e. logger@somedomain.xyz) whenever someone uses the app to send a message. Or you could alternatively save the information contained in the message to a database if you don't need it in email format.

              2. CF doesn't actually deliver the message, it hands the message off to some sort of mailer-daemon. On Windows that would typically be IIS, and on linux something like Postfix. The mailer-daemon is the program actually responsible for contacting the recipient's mailserver and delivering the message.

              If we're talking about IIS SMTP, then you don't have the abliity to do what you want. It can send a non-delivery report and save failed messages but it can't send copies of successful deliveries.

              At HostMySite we use Smartermail as our shared email solution. Since SmarterMail is a more robust email platform (compared to IIS SMTP, which just delivers mail) there is serverside f unctionality in it that will allow a serverwide rule to be put into place that saves a copy of all outbound messages in archived .zip files.

              So, it boils down to what you're using to send, and what sort of capabilities it has...and if you're on a shared host, whether or not that sort of thing would be allowed.
              • 4. Re: Log email text
                Level 7
                Torgom wrote:
                > Mack,
                >
                > Do you know how to do that?

                Like I said tersely in my previous message it depends on your specific
                environment and restrictions (as Fetch pointed out). So the solution
                will be different depending on whether you're on shared hosting or
                dedicated hosting, Linux with qmail, Linux with postfix, Windows, etc.

                --
                Mack
                • 5. Re: Log email text
                  Fetch Level 1
                  Sorry Mack, I don't do the whole brevity thing. ;-)