Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

objMail - not sending/recieving but no errors

Status
Not open for further replies.

th3maw

Programmer
Feb 16, 2005
26
GB
Sorry if this is not the right place to ask this.

I am having problems sending emails from asp pages which are running internally.

We use another host for our sites and in these the various methods I have tried for sending mail work correctly. However when I try to run identical code for the intranet on our interal server I do not get any errors, but the emails are not sent.

Changes have recently been made to our server by an independant IT company, so I think this may have caused the problem, however I am not sure what needs to be changed and I want to rule out anything obvious first.

As I said I dont actually get any errors when I run the code, however I am sure it is being processed as if I alter the settings to what I know is incorrect it does then give me errors.

I am currently using the following -

Code:
    Dim HTML1
    Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
	
    dim objMail
    set objMail = Server.CreateObject("CDO.Message")	
	
    HTML1 = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"
    HTML1 = HTML1 & "<html>"
    HTML1 = HTML1 & "<head>" 
    HTML1 = HTML1 & "<title>Quotation concerning " & rstQuoteJob("JobTitle") & "</title>"
    HTML1 = HTML1 & "</head>"
    HTML1 = HTML1 & "<body bgcolor=""FFFFFF"">"
    HTML1 = HTML1 & "<p><font size =""2"" face=""Verdana"">"
    HTML1 = HTML1 & "The quotation is attached to this email.<p>"
    HTML1 = HTML1 & "</body>"
    HTML1 = HTML1 & "</html>"

	
    objMail.From = "email@here.com"
    objMail.To = "th3maw@here.com"
    objMail.Subject = "Quotation"
    objMail.AddAttachment(strAttachedFile) 
    objMail.HTMLBody = HTML1
    objMail.Send	
			
    set objMail = nothing

As I stated previously, I am running identical code with our external host and it works correctly.

So my questions are...

Why am I not getting any errors?

What might be missing/incorrectly set on our internal server that could cause this problem?

If you have any other ideas or suggestions let me know.

I think I will have to go back to the IT company and ask them to look into it, however I want to be armed with as much information as possible first.

Thanks

th3maw
 
You may want to try using the more recent ASP code for mailing, CDO.

In the code below, you must specify your SMTP server.

Code:
'Sending a text email using a remote server  

Set objMessage = CreateObject("CDO.Message") 
objMessage.Subject = "Test Msg." 
objMessage.Sender = "someValidEmailAddress@domain.com" 
objMessage.To = "whoever@otherDomain.com" 
objMessage.TextBody = "My CDO Body."

'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.

objMessage.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2 

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = "your.smtp.server.com"

'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25 

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==

objMessage.Send

All hail the INTERWEB!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top