Solved

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

Posted on 2003-11-30
9
478 Views
Last Modified: 2010-05-18
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
%>
0
Comment
Question by:reedy2k
  • 5
  • 2
9 Comments
 
LVL 4

Expert Comment

by:c_swanky
Comment Utility
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>
0
 

Author Comment

by:reedy2k
Comment Utility
thanks for the reply, i tried yours but nothing still!

Any ideas what else I can do to troubleshoot?

0
 
LVL 4

Expert Comment

by:c_swanky
Comment Utility
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?



0
 
LVL 4

Expert Comment

by:c_swanky
Comment Utility
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>



0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 4

Expert Comment

by:c_swanky
Comment Utility
Any Status Updates?
0
 

Author Comment

by:reedy2k
Comment Utility
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
0
 
LVL 4

Accepted Solution

by:
c_swanky earned 60 total points
Comment Utility
Don't give up..   If you're getting a version # back then we're still in the ball game.


(1) I just noticed the incorrect syntax here (surprise it didn't throw an error)

     '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



SHOULD BE: (the Response. was missing)

     'Send the message!
     bSuccess = oMailer.Send()
     If bSuccess = True Then
          Response.Write "Message sent successfully."
     Else
          Response.Write "Message could not be sent."
          If Mailer.Queued = True Then
               Response.Write "Message Queued Instead."
          End If
     End If



(2) Make sure to remove the line with  "Response.End()     '<--comment out if version is returned"     We don't need it anymore.

(3) Even if you think the mail server IP is good, double check with the hosting service.  (I had one host that was setup to use the mail server IP, while another used the IP for the web site.... I had the same symptoms as you and it was VERY frustrating as you can image. It's amazing what a difference an IP makes....)

Make sure you state that you are using the Geocel.Mailer when contacting tech support.

1,2,3, and you're back in service!




 
0
 
LVL 8

Expert Comment

by:fozylet
Comment Utility
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
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
add custom headers to my mail 2 41
SQL Server Web Traffic Limitations 4 41
INNER JOIN ? 8 29
Auto Submit on dropdown box 3 32
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now