1. Please take a little time for this simple survey! Thank you for participating!
    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

    0
     
    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>"

    oMail.SendMessage


    Anyone solved this issue?
     
  2. chernobl

    chernobl Guest

    0
     
    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:
    0=Low
    1=Normal (default) 2=High
    .BodyFormat Format of the message
    0=Text (default)
    1=HTML
    .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.value("Reply-to")="reply@mail.com"
    MyCDO.AttachFile = "e:\files\catalog.zip"
    MyCDO.Send
    Set MyCDO = nothing
    Response.Write("Message sent")
    Else
    Response.Write("Message not sent")
    End If
    %>
     
  3. webmotion

    webmotion Guest

    0
     
    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

    ~web
     
  4. Pauli

    Pauli Guest

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

    abagla Guest

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

    webmotion Guest

    0
     
    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

    0
     
    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.

    Cheers
     
  8. chuck.boyer

    chuck.boyer Guest

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

    Chuck
     
  9. ad7742

    ad7742 Guest

    0
     
    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:

    http://support.microsoft.com/default.aspx?scid=kb;en-us;286431

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


    Code:
    <%
        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";) = "127.0.0.1"
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout";) = 10
            .Update
        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!"
            .Send()
        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.

    Andy
     
  10. addstravel

    addstravel Guest

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

    Cheers mate.

    :)
     
  11. globodata

    globodata Guest

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

    ad7742 Guest

    0
     
    /24 will work. However, /32 is more secure because it restricts the whitelist IP address to ONLY 127.0.0.1 rather than the range 127.0.0.0 to 127.0.0.255 (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

    0
     
    Thanks you, Addstravel !
     
  14. addstravel

    addstravel Guest

    0
     
    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

    0
     
    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,
    Andy
     
  16. keymasterdk

    keymasterdk Basic Pleskian

    24
    73%
    Joined:
    Mar 4, 2008
    Messages:
    86
    Likes Received:
    0
    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

    0
     
    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 127.0.0.1 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 127.0.0.1 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.

    Reagards
    Mark
     
Loading...