SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Mar 2009
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool Sending mail from ASP. Why so hard? :(

    Hey all,

    I've been trying to get my ASP page (hosted on godaddy) to send mail. I do not have a smtp server available to me as far as I know fromk godaddy to use.

    How can I get my ASP page to send mail? Is there a free SMTP server I can use? I did find a webpage that claimed to have many free smtp servers... but the script never worked.

    Below is the code i used. If I put in a free SMTP server and delete the username/password lines it doesn't work.

    What am I missing?

    Thanks!


    Code:
    <%
    Const cdoBasic = 1 'Use basic (clear-text) authentication.
    Const cdoSendUsingPort = 2
    'cdosys related
    Dim iMsg
    Dim iConf
    Dim Flds
    'mail related
    Dim strMsg
    Dim strTo
    Dim strCC
    Dim strFrom
    Dim strSubject
    Dim strTextBody
     
     
    '==================begin your configuration=============================
    'you must have a username and pass word or you will not be able to send
    '
    Dim sendusername : sendusername = "user@userdomain.com"  '///this email must be exist
    Dim userpassword : userpassword = "yourpassword"         '///password must be correct
    Dim smtpserver : smtpserver = "yoursmtpserver"
    'end your configuration
     
    '===================begin set your info here============================
    'set your TO, CC, From, Subject and body here
    '
    strTo = "touser@somedomain.com"
    strCC = "anotheruser@somedomain.com"
    strFrom = "fromuser@somedomain.com"
    strSubject = "Insert here your subject text"
    strTextBody = "Insert here your plain body text"
    'end set your info here
     
     
    'Create message and configuration objects
    set iMsg = CreateObject("CDO.Message")
    set iConf = CreateObject("CDO.Configuration")
    Set Flds = iConf.Fields
    'Apply settings to the configuration object
    With Flds
    ' Specify the authentication mechanism to basic (clear-text) authentication.
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
    ' The username for authenticating to an SMTP server
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = sendusername
    ' The password used to authenticate to an SMTP server
    .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = userpassword
    ' Port
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
    'Specify mail server
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpserver
    'Specify the timeout in seconds
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
    ' The port on which the SMTP service specified by the smtpserver field is listening for connections (typically 25)
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    'Use SSL for the connection (False or True)
    '.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
    .Update
    End With
     
    'Apply the settings to the message object and send it
    With iMsg
    Set .Configuration = iConf
    .To = strTo
    .From = strFrom
    If strCC <> "" Then
    .CC = strCC
    End If
    .Subject = strSubject
    .TextBody = strTextBody
    'Send message
    .Send
    End With
    ' cleanup mail objects
    Set iMsg = Nothing
    Set iConf = Nothing
    Set Flds = Nothing
    %>

  2. #2
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    check with the web host. They'll tell you what to use for an SMTP server.

    They usually even have code examples to work from.

  3. #3
    Non-Member
    Join Date
    Aug 2008
    Location
    Nepal
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <!--
    METADATA
    TYPE="typelib"
    UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
    NAME="CDO for Windows 2000 Library"
    -->'=====mail send configuration
    With cdoConfig.Fields
    .Item(cdoSendUsingMethod) = cdoSendUsingPort
    .Item(cdoSMTPServer) = "mail.kist.com"
    .Item(cdoSMTPAuthenticate) = 1
    .Item(cdoSendUsername) = "info@kist.com"
    .Item(cdoSendPassword) = "......"
    .Update
    End With

    Set myMail=CreateObject("CDO.Message")
    Set myMail.Configuration = cdoConfig
    myMail.Subject="School sign-up notification"
    myMail.From=email address
    myMail.To=trim(request.Form("eid"))
    myMail.Bcc=email add
    myMail.HTMLBody =message
    myMail.Send()
    set myMail=nothing
    Set cdoConfig=nothing
    Its working perfectly but all email address and password should match
    Last edited by rajendradhakal; May 27, 2010 at 19:50. Reason: add


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •