Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


ASP MAPI mail not sending?

Posted on 2003-02-25
Medium Priority
Last Modified: 2010-07-27
Several forms that automatically send email to various recipients, none of them appear to be working recently (about 3 weeks), although they've worked fine previously, and no changes have been made to the code.  

The pages give the impression the email is being sent, no error message is generated, but the recipients never receive any email.  Can't find any undelivered emails on the server (could be I'm not looking in the correct place), or any clues as to what's wrong.  

Some code that's being used (slightly edited):


body = "blah blah blah"

' Create the CDO session object
Set objSession = CreateObject("MAPI.Session")
bstrProfileInfo = "LOTNWEB1"  + vbLf + "AnonUser"
objSession.Logon , , , true, , true, bstrProfileInfo

' create a message and fill in its properties
Set objMessage = objSession.Outbox.Messages.Add
objMessage.Subject = "Property Enquiry from a Tenant"

objMessage.Text =  body

' create the recipient
Set objOneRecip = objMessage.Recipients.Add

If agent_email = "" Then
     objOneRecip.Name = friends_email
     objOneRecip.Name = agent_email
     Set objTwoRecip = objMessage.Recipients.Add
     objTwoRecip.Name = "scotland@blahblahblah.com"
     Set objThreeRecip = objMessage.Recipients.Add
     objThreeRecip.Name = "duncan.cumming@alienationdesign.co.uk"
End If

On Error Resume Next
objOneRecip.Resolve ' get MAPI to determine complete e-mail address

If Err.Number <> 0 Then
     error = "FAILED"
     On Error Goto 0
     error = "SENT"
     On Error Goto 0
     ' send the message and log off
     objMessage.Send showDialog=false

     Response.Write "<html><head><title>Send an Email</title></head><body bgcolor=""#FFFFCC""><BR><BR><BR><BR><FONT face=""Tahoma, Verdana, Arial"" size=""2"" color=""#000066""><B><CENTER>Your Email has been sent<BR><BR><BR>     <a HREF=""javascript:window.close()"">Click Here to close this window</a></CENTER></B></FONT></body></html>"

End If


Set objSession = nothing
Set objMessage = nothing
Set objOneRecip = nothing

Set cmdInsEmail = Nothing
set rst = nothing
Set Conn = Nothing

The message 'Your Email has been sent' get's displayed, so users assume their email has in fact been sent.  None of the recipients get any email however.  I think the code is correct (it used to work), and it's more likely something like a service on the server not being started?  any ideas please.

Question by:duncancumming
  • 2

Accepted Solution

markhoy earned 225 total points
ID: 8017033
is the mail being kept in "badmail"?is the smtp service running? can you send email from the server using Outlook?

test your script and then do a search on *.eml on the server running the IIS service. sounds like the smtp smarthost isn't being resolved or the smtp host it points to isn't running.
LVL 16

Author Comment

ID: 8017349
can't find any 'badmail' folder.  

The Microsoft Message Transfer Agent service wasn't started; starting it generated an error, something which relates back to a problem the client had last year which was supposedly fixed by a 3rd party.  

Sending mail from Outlook... not working.  Email remains in outbox, and doesn't get sent.  Send/Receive briefly pops up the dialog box, but doesn't appear to actually send it.  I assume because the MTA isn't running.

*.eml search returns > 2000 items, dating back from 2000 - 2002, but nothing recently.  This was all from earlier problems they'd had with their mailserver.  

Apparently they *are* receiving some emails sent through the site, depending on the form used.  I'll compare code and spot the differences.  Thanks for the pointers.
LVL 16

Author Comment

ID: 8017645
it seems the mail that is working uses CDONTS; the mail that's not working uses MAPI.  Would it be a good short-term solution to change all the MAPI mail to CDONTS mail?  I don't really know what the differences are between them, or any advantages/disadvantages of either method.

Expert Comment

ID: 9576872
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 informatio…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Integration Management Part 2
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

571 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