1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

How to send mail from ASP pages?

Discussion in 'Plesk for Windows - 8.x and Older' started by nickpick, Dec 26, 2003.

  1. nickpick

    nickpick Guest

    Having problems using a webform with ASP sending mail.

    In a standard IIS install it works, but with Plesk 6.5 installed (and thus Mail Enable), it won't work and I can't send mail with a web form.
    I replaced the mailing part in my ASP script with following (taken from www.mailenable.com) :

    Dim oMail

    Set oMail = server.CreateObject("MEMail.Message")

    oMail.MailFrom = "test@mydomain.com"

    oMail.MailFromDisplayName = "Test Account"

    oMail.ContentType = "text/html;"

    oMail.MailTo = "test@mydomain.com"

    oMail.Subject = "Welcome to our service"

    oMail.MessageBody = "<html><body><h1>Hello there,<BR>Welcome to our new service.</h1></body></html>"


    Anyone solved this issue?
  2. chernobl

    chernobl Guest

    Here is a sample

    The Object (CDONTS.NewMail) has several properties and methods that you must know:

    .From E-mail address of the sender
    .To E-mail address of the recipient
    .CC CC recipient e-mail address
    .Subject Subject of the message
    .Importance Importance of the message:
    1=Normal (default) 2=High
    .BodyFormat Format of the message
    0=Text (default)
    .Value(Name) New header
    .Body Body of the message
    .AttachFile Attaches a file (it is needed to indicate the real path
    , not the web path of the file)
    .Send Calling this method the message is sent

    Here you can download an example sending a text message and using several of the properties listed above.

    I hope you find this useful!

    On Error resume Next
    Dim TBdy
    Dim MyCDO
    CR = Chr(13)
    Set MyCDO = Server.CreateObject("CDONTS.NewMail")
    If IsObject (MyCDO) Then
    MyCDO.From = "mail@mail.com (Mr Originating)"
    MyCDO.To = "mailto@mail.com (Mr recipient)"
    MyCDO.Subject = "Subject of the message"
    TBdy = "Dear Sir," & CR & CR & "This is a new mail" & CR
    TBdy = TBdy & "Thank you."
    MyCDO.Body = TBdy
    MyCDO.Importance = 2 (High)
    MyCDO.AttachFile = "e:\files\catalog.zip"
    Set MyCDO = nothing
    Response.Write("Message sent")
    Response.Write("Message not sent")
    End If
  3. webmotion

    webmotion Guest

    You can still use your oold "Cdonts" code...

    Stop the service and try setting your SMTP virtual server to port 2525, that fixed ours... then restart the SMTP service

  4. Pauli

    Pauli Guest

    Does the same problem exist when using ASPMail?
  5. abagla

    abagla Guest

    I changed the port but the smtp service in IIS service manager is not getting started
  6. webmotion

    webmotion Guest

    You using windows 2003 server or the older one?

    You need to decide which port you want your SMTP server to send emails from. By default the port is 25, only use 25 if you have not got another SMTP service running. If you want to use port 25 goto STEP 5. If you want to change port, we recommend to Port 17. Port 17 is currently being used for Welcome message. So we need to disable it and make SMTP use port 17. Goto C:\WINNT\system32\drivers\etc and edit the file called services in NOTEPAD

    Disable the following lines by putting a # in front of them
    # qotd 17/tcp quote #Quote of the day
    # qotd 17/udp quote #Quote of the day

    You also need to change the line
    smtp 25/tcp mail #Simple Mail Transfer Protocol
    to read
    smtp 17/tcp mail #Simple Mail Transfer Protocol
    Save changes.
  7. addstravel

    addstravel Guest

    WIn2k issue

    I have had the same issue and found out that CDONTS is not installed by default on win2003! I was surprised....

    I am looking at CDO now.

  8. chuck.boyer

    chuck.boyer Guest

    FYI - Win2k3 no longer installs cdonts by default. It is now using cdosys which is the follow on to cdonts.

  9. ad7742

    ad7742 Guest

    You can use CDO on Win2K3 running Plesk 6.5. I was originally getting an error saying

    "The "SendUsing" configuration value is invalid."

    However, I found the following article on the Microsoft site:


    The code below works fine on Plesk 6.5 for Windows (so long as you ensure that is on the SMTP whitelist in the control panel):

        Const cdoSendUsingPort = 2
        set iConf = CreateObject("CDO.Configuration")
        Set Flds = iConf.Fields
        With Flds
            .Item("http://schemas.microsoft.com/cdo/configuration/sendusing";) = cdoSendUsingPort
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver";) = ""
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout";) = 10
        End With
        Dim MyMail
        Set MyMail = Server.CreateObject("CDO.Message")
        With MyMail
            .Configuration = iConf
            .From = "emailsender@wherever.com"
            .To = "emailrecipient@wherever.com"
            .Subject = "Sending Mail via CDOSYS for Windows 2000/XP"
            .TextBody = "Sending email with CDOSYS Message " &_
                "objects is easy! Try it!"
        End With
        Set MyMail = Nothing
    This therefore allows sending of ASP emails without needing to install the out-dated CDONTS component or installing the IIS SMTP service.

    Hope this helps.

  10. addstravel

    addstravel Guest

    Thank you so so much for this! I have been searching high and low to do this.

    Cheers mate.

  11. globodata

    globodata Guest

    To include this IP in the White List, whick mask I should use ? I´ve used /24 . It will work ?
  12. ad7742

    ad7742 Guest

    /24 will work. However, /32 is more secure because it restricts the whitelist IP address to ONLY rather than the range to (not that you will ever realistically see traffic from these private IP ranges!)

    Oh, and no problems, addstravel - glad it helped!
  13. globodata

    globodata Guest

    Thanks you, Addstravel !
  14. addstravel

    addstravel Guest

    THe CDO code works great, but only for external domains and not local domains that use external mail servers.

    Even when I use horde webmail I am unable to send an email to a local domain. Any ideas?

    Clients aren't happy the ASP CDO code is not sending emails from their web pages... :(
  15. artipton

    artipton Guest

    Same Issue

    I have IIS 6.0 and MailEnable on a Windows 2003 Server. I guess I am having a little more trouble jumping in on the conversation, but do I need to use MailEnable and IIS SMTP? Do I set the IIS SMTP to port 2525 and listen on an alternate port in MailEnable?

    I have scratching my head trying to figure this out... Any help is much appreciated.

    Thank you,
  16. keymasterdk

    keymasterdk Basic Pleskian

    Mar 4, 2008
    Likes Received:
    Hi :)

    I have a client that would like to use ASPMail but i cant get it working for him. I have read all i could here on the board but it still not works, could it be that the problem is that i use Merak as mail server as the mailenable is then stopped ? Please help..

    Regards John From DK.
  17. steve009

    steve009 Guest

    CDO Error "Could not access ' CDO.Message' object"

    Hi Master minds

    I have issue in plesk 7.6 windows, From server unable to use asp mail facility, every body getting error like "Could not access ' CDO.Message' object".As i read other articles on Plesk forums,(1) i have to white list on control panel that is for plesk6.5, is this same thing applicable to Plesk7.6 or not? (2) I am not able to white list on plesk panel due to subnet also required with ip address in plesk 7.6 (3) How can we find wether CDO component installed or not

    Please provide any solution for the same.