email server connection strings

Discussion in 'Email' started by Bryson, Feb 4, 2013.

  1. I run an interactive site for secondary school science.
    I recently moved to Winhost and need to change the email connection strings so that the Learning management System (LMS) can send out emails.
    Unfortunately I have no idea how to change or integrate the new coding into my .asp file.

    My current connectionstring.asp has this:


    <%
    on error resume next
    response.buffer=true

    dim connectionstring
    dim connectionstringcourse

    //connection strings for Microsoft Access format database.
    connectionstring="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database/kplms.mdb") & "; Jet OLEDB:Database Password = knowledge;"
    connectionstringcourse="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database/kpcourses.mdb") & ";"
    //connection strings for SQL Server format database. This may need to be altered based on your SQL Server database setup.
    //connectionstring="Provider=SQLOLEDB; Data Source = (local); Initial Catalog = kplms7; User Id = sa; Password="
    //connectionstringcourse="Provider=SQLOLEDB; Data Source = (local); Initial Catalog = kpcourses7; User Id = sa; Password="

    dim emailpath
    dim emailtype
    emailpath="c:\inetpub\mailroot\pickup"

    //string, in HTML, added to the beginning of every email
    emailheader=""

    //string, in HTML, added to the end of every email
    emailfooter=""

    //string, in plain text, added to the end of the subject line
    emailtitlesuffix=""

    //must be set to "CDONTS" or "CDOSYS"
    emailtype="CDOSYS"

    Function SendAnEmail(strTo, StrFrom, strSubject, strBody, strCC, StrBCC)
    on error resume next
    strBody=strBody & emailfooter
    strBody=emailheader & strBody
    strSubject=strSubject & emailtitlesuffix
    select case emailtype
    Case "CDOSYS"
    Dim ObjSendMail
    Dim iConf
    Dim Flds
    Set ObjMessage = CreateObject("CDO.Message")
    Set objConfig = CreateObject("CDO.Configuration")
    Set Flds = objConf.Fields
    Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.els247.com"
    ' ' Passing SMTP authentication
    Flds.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
    Flds.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="[email protected]"
    Flds.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="rovers"

    Flds.update
    Set objMessage.Configuration = objConfig
    objMessage.To = "[email protected]"
    objMessage.From = "[email protected]"
    objMessage.Subject = "New Task"
    objMessage.fields.update
    objMessage.HTMLBody = "This is a test sent from CDO using smtp authentication."
    objMessage.Send
    Case "CDONTS"
    set objMsg = Server.CreateObject("CDONTS.NewMail")
    With objMsg
    .To = strTo
    .From = strFrom
    .Subject = strSubject
    .MailFormat = 0
    .BodyFormat = 0
    .Body = strBody
    .CC=strCC
    .BCC=strBCC
    .Send
    End With
    set objMsg=nothing
    end select
    End Function

    Function UploadAvatar()
    on error resume next
    Dim mySmartUpload
    Dim intCount
    Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
    mySmartUpload.AllowedFilesList = "gif,png,jpg,jpeg"
    mySmartUpload.MaxFileSize = 100000
    mySmartUpload.Upload
    For each file In mySmartUpload.Files
    If not file.IsMissing Then
    Randomize
    newfilename = Round(((2147483647 * Rnd) + 1), 0) & "." & right(file.filename,3)
    file.SaveAs("/avatars/" & newfilename)
    End If
    Next
    if err then
    response.redirect "fileuploaded2.html?filename=" + myfolder
    else
    response.redirect "fileuploaded.html?filename=" + newfilename
    end If
    end function

    //* Version 7. Do Not Remove or Edit This Line/*
    %>



    Winhost support has given me this:
    <%
    set objMessage = createobject("cdo.message")
    set objConfig = createobject("cdo.configuration")
    Set Flds = objConfig.Fields

    Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.mydomain.com"

    ' ' Passing SMTP authentication
    Flds.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
    Flds.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="[email protected]"
    Flds.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="password"

    Flds.update
    Set objMessage.Configuration = objConfig
    objMessage.To = "[email protected]"
    objMessage.From = "[email protected]"
    objMessage.Subject = "New Task"
    objMessage.fields.update
    objMessage.HTMLBody = "This is a test sent from CDO using smtp authentication."
    objMessage.Send
    %>

    But I have no idea how to proceed.
    I hope someone can help.
    Thanks in anticipation
    Bryson Dalgleish
     
  2. Elshadriel

    Elshadriel Winhost Staff

    There are a few things you might need to change such as this:

    A path to the root of your site account can be found in the Control Panel.

    Where it says "mydomain.com" in the code we provided you, you probably need to replace it with the domain name in your site.
     

Share This Page