Skip to main content
Known Participant
July 30, 2010
Question

CDO COM email script in CF7

  • July 30, 2010
  • 2 replies
  • 782 views

I have having issues trying to determine how I can specify the sending server when creating a object that is using CDO COm. I have a script that I have tried but it just sends with the default server and not the one I specified. I have searched the web and asked around and I get no response. This code is kind of a compilation of other scripts and I don't want to say I know anything about this process. If anyone could give me resources to see what can be used or give me more insight on Objects that might help.

<cfscript>

objMail = CreateObject("COM","CDO.Message");

objMail.To="account@mail.com";

objMail.From="account@mail.com";

objMail.Subject="CDO COM CF Test";

objMail.HTMLBody="<h1>Cdo CF TEST</h1>";

iFlds = objMail.Fields;

// Set SendUsing

sendusing = iFlds.Item;

sendusing.value = "2";

// Set SMTP Server

smtpserver = iFlds.Item;

smtpserver.value= "mail.mailserver.com";

// Set Port

smtpserverport = iFlds.Item;

smtpserverport.value = "25";

iFlds.Update();

objMail.Send();

objMail="";

</cfscript>

    This topic has been closed for replies.

    2 replies

    Sin0cideAuthor
    Known Participant
    August 2, 2010

    I understand what you mean but it is cfscript that is using cdo COM so I believe it still applies as a coldfusion question. I have been supporting coldfusion for about 1 year but I have not been developing it. I am guessing that there might be an api or something like you suggested but have no idea where to find it. If you try and search for this on the web it is asked a lot and nobody has ever responded. Figured someone on here might have a slight clue. Thanks for the info.

    Inspiring
    August 3, 2010

    I know I did not respond because .. I do not know anything about CDO.  A quick google turned up these links which mention a separate Configuration object which may (or may not) be of use to you. But as "usage" details seem to be more in the realm of asp, that is about all I can tell you.

    http://www.w3schools.com/asp/asp_send_email.asp

    http://msdn.microsoft.com/en-us/library/aa488364(v=EXCHG.65).aspx

    Message was edited by: -==cfSearching==-

    Sin0cideAuthor
    Known Participant
    August 2, 2010

    Wow nobody knows? I am guessing a lot of people don't think this should be done. I agree but I have a customer that wants to do it.

    Inspiring
    August 2, 2010

    It's possibly because you seem to be asking a question about CDO on a CF forum..?  It might be a better approach to ask the question on a CDO forum?

    I don't mean to be dismissive (and it could come across that way depending on how you read the above), it's just you're drawing a blank here, and it doesn't really seem to be a CF question.

    Is there not a published CDO API out there somewhere?

    --

    Adam