Link to home
Start Free TrialLog in
Avatar of reedy2k
reedy2k

asked on

Geocel Devmailer ASP mailer - doesnt error but doesnt send the email

Please could someone run their eyes over this, originally from ASP101 script, and I changed it to Geocel rather than CDONTS, but it just doesnt work.

Any ideas? (obviously I have replaced with dummy IP address and email etc)

-----------------------------------------------------------

<%
Dim strTo, strSubject, strBody 'Strings for recipient, subject, body
Dim objCDOMail 'The CDO object


'First we'll read in the values entered
strTo =  Request.Form("recipient")

'These would read the message subject and body if we let you enter it
'strSubject = Request.Form("subject")
'strBody = Request.Form("body")

' Both of these should be changed before you run this script.
strSubject = "Sample E-mail from blah"

' This is multi-lined simply for readability
strBody = "This message was sent from blah.  "


' Some spacing:
strBody = strBody & vbCrLf & vbCrLf

strBody = strBody & "This was sent to: "

' A lot of people have asked how to use form data in the emails so
' I added this line to the sample as an example of incorporating form
' data in the body of the email.
strBody = strBody & Request.Form("recipient")

' A final carriage return for good measure!
strBody = strBody & vbCrLf


If strTo = "" Or Not IsValidEmail(strTo) Then
      %>
      <FORM ACTION="./email.asp" METHOD="post">
            Enter your e-mail address:<BR>
            
  <INPUT TYPE="text" NAME="recipient" SIZE="30">
  </INPUT>

            <!--  These would be used if we decided to let you edit them
            Subject:&nbsp;
            <INPUT TYPE="text" NAME="subject" SIZE="30"></INPUT><BR>
            
            Message:&nbsp;
            <TEXTAREA NAME="body" ROWS="10" COLS="40" WRAP="virtual"></TEXTAREA><BR>
            -->

            <INPUT TYPE="submit" VALUE="Send Mail!"></INPUT>
      </FORM>
      <%
Else
      ' Create an instance of the NewMail object.
      Set objCDOMail = Server.CreateObject("Geocel.Mailer")
      
      
      ' This syntax works fine
      'objCDOMail.From = "user@domain.com"
      ' But this gets you the appearance of a real name!
objCDOMail.ContentType = "text"
      objCDOMail.FromName    = "User Name <user@domain.com>"
      objCDOMail.AddServer "195.blah.blah.blah", 25
      objCDOMail.Subject = strSubject
      objCDOMail.Body    = strBody
objCDOMail.AddRecipient StrTo, "Steve"

      
      ' Send the message!
      objCDOMail.Send()
      
      ' Set the object to nothing because it immediately becomes
      ' invalid after calling the Send method.
      Set objCDOMail = Nothing

      Response.Write "Message sent to " & strTo & "!"
      'Response.Write "Message ARE NO LONGER BEING SENT because of all the abuse the system was receiving!"
End If
' End page logic
%>

<% ' Only functions and subs follow!

' A quick email syntax checker.  It's not perfect,
' but it's quick and easy and will catch most of
' the bad addresses than people type in.
Function IsValidEmail(strEmail)
      Dim bIsValid
      bIsValid = True
      
      If Len(strEmail) < 5 Then
            bIsValid = False
      Else
            If Instr(1, strEmail, " ") <> 0 Then
                  bIsValid = False
            Else
                  If InStr(1, strEmail, "@", 1) < 2 Then
                        bIsValid = False
                  Else
                        If InStrRev(strEmail, ".") < InStr(1, strEmail, "@", 1) + 2 Then
                              bIsValid = False
                        End If
                  End If
            End If
      End If

      IsValidEmail = bIsValid
End Function
%>
Avatar of c_swanky
c_swanky

Did see a function "IsValidEmail" so thatwould cause some problems right there.

Try this: name it email.asp and place your server, from vallues...



<%

If len(request.Form("Submit")) > 0 Then

      Dim strTo, strSubject, strBody 'Strings for recipient, subject, body
      Dim objCDOMail 'The CDO object
      
      
      'First we'll read in the values entered
      strTo =  Request.Form("recipient")
      
      'These would read the message subject and body if we let you enter it
      'strSubject = Request.Form("subject")
      'strBody = Request.Form("body")
      
      ' Both of these should be changed before you run this script.
      strSubject = "Sample E-mail from blah"
      
      ' This is multi-lined simply for readability
      strBody = "This message was sent from blah.  "
      
      
      ' Some spacing:
      strBody = strBody & vbCrLf & vbCrLf
      
      strBody = strBody & "This was sent to: "
      
      ' A lot of people have asked how to use form data in the emails so
      ' I added this line to the sample as an example of incorporating form
      ' data in the body of the email.
      strBody = strBody & Request.Form("recipient")
      
      ' A final carriage return for good measure!
      strBody = strBody & vbCrLf
      
       ' Create an instance of the NewMail object.
       Set objCDOMail = Server.CreateObject("Geocel.Mailer")
      
      
       ' This syntax works fine
       'objCDOMail.From = "user@domain.com"
       ' But this gets you the appearance of a real name!
       objCDOMail.ContentType = "text"
       objCDOMail.FromName    = "User Name <user@domain.com>"
       objCDOMail.AddServer "195.blah.blah.blah", 25
       objCDOMail.Subject = strSubject
       objCDOMail.Body    = strBody
       objCDOMail.AddRecipient StrTo, "Steve"
      
      
       ' Send the message!
       objCDOMail.Send()
      
       ' Set the object to nothing because it immediately becomes
       ' invalid after calling the Send method.
       Set objCDOMail = Nothing
      
       Response.Write "Message sent to " & strTo & "!"
       'Response.Write "Message ARE NO LONGER BEING SENT because of all the abuse the system was receiving!"
      End If                        


 %>
 
 <FORM ACTION="email.asp" METHOD="post">
          Enter your e-mail address:<BR>
         
  <INPUT TYPE="text" NAME="recipient" SIZE="30">
  </INPUT>

          <!--  These would be used if we decided to let you edit them
          Subject:&nbsp;
          <INPUT TYPE="text" NAME="subject" SIZE="30"></INPUT><BR>
         
          Message:&nbsp;
          <TEXTAREA NAME="body" ROWS="10" COLS="40" WRAP="virtual"></TEXTAREA><BR>
          -->

          <INPUT TYPE="submit" name="Submit" VALUE="Send Mail!"></INPUT>
     </FORM>
Avatar of reedy2k

ASKER

thanks for the reply, i tried yours but nothing still!

Any ideas what else I can do to troubleshoot?

Are you getting any error messages?

You can set the following in your browser to get detailed error messages:
From the IE tool bar select   Tools > Internet Options
Click the Advance Tab
Make sure that "Show friendly HTTP error messages" is NOT checked.


Are you running this from a local server or a hosted site?



I was able to make the code hang by not having the correct IP and Port information, but just to make sure it's not something else do the following:

1) Put "toMailer.Version"  & Response.End() afer you create the object to make sure you have the compent installed on the server (see code below)

   'Create an instance of the NewMail object.
   Set oMailer = Server.CreateObject("Geocel.Mailer")
   Response.Write "Software version : " & oMailer.Version & "<br>"
   Response.End()

2) Are you getting a value for "Software Version"?  If "YES" then go ahead and comment out the two new lines and contact the hosting company. Ask them which IP and Port you should be using;

objCDOMail.AddServer "195.blah.blah.blah", 25




<%

If len(request.Form("Submit")) > 0 Then

      Dim strTo, strSubject, strBody, oMailer
      
      
      'First we'll read in the values entered
      strTo =  Request.Form("recipient")
      strSubject = "Sample E-mail from blah"
      strBody = "This message was sent from blah.  " & vbCrLf & vbCrLf
      strBody = strBody & "This was sent to: " & Request.Form("recipient") & vbCrLf
      
      'Create an instance of the NewMail object.
      Set oMailer = Server.CreateObject("Geocel.Mailer")
      Response.Write "Software version : " & oMailer.Version & "<br>"
      Response.End()      '<--comment out if version is returned
      
      oMailer.FromAddress = "someaddress@geocel.com"
      oMailer.FromName    = "User Name"
      oMailer.AddServer "192.222.222.22", 25            '<-- Contact your Hosting service for this information
      oMailer.Subject = strSubject
      oMailer.Body    = strBody
      oMailer.AddRecipient StrTo, "Steve"
      
      'Send the message!
      bSuccess = oMailer.Send()
      If bSuccess = True Then
            Write "Message sent successfully."
      Else
            Write "Message could not be sent."
            If Mailer.Queued = True Then
                  Write "Message Queued Instead."
            End If
      End If
      
      ' Set the object to nothing because it immediately becomes invalid after calling the Send method.
      Set oMailer = Nothing
      
End If                        


 %>
 
 <FORM ACTION="email.asp" METHOD="post">
          Enter your e-mail address:<BR>
         
  <INPUT TYPE="text" NAME="recipient" SIZE="30">
  </INPUT>

          <!--  These would be used if we decided to let you edit them
          Subject:&nbsp;
          <INPUT TYPE="text" NAME="subject" SIZE="30"></INPUT><BR>
         
          Message:&nbsp;
          <TEXTAREA NAME="body" ROWS="10" COLS="40" WRAP="virtual"></TEXTAREA><BR>
          -->

          <INPUT TYPE="submit" name="Submit" VALUE="Send Mail!"></INPUT>
     </FORM>



Any Status Updates?
Avatar of reedy2k

ASKER

I tried the last suggestion and it displays the version number but still no email.
I know the mail server address is correct because they have formmail set up in a similar way.

I might just butcher formmail instead at this rate
ASKER CERTIFIED SOLUTION
Avatar of c_swanky
c_swanky

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
    Accept: c_swanky {http:#9873373}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

fozylet
EE Cleanup Volunteer