Quantcast
Channel: Classic ASP
Viewing all articles
Browse latest Browse all 488

[solved] Unable to send an email from an .asp page

$
0
0

Hello,

I have a vbscript function, that sends an email out to a specific email address, using the user's email address as the email "sender"

This code worked when we were using Exchange 2003, but now that we upgraded to Exchange 2013, the code no longer works.

This code is located in a functions.asp page, which can be called by other .asp pages.  The server that this code is located on is NOT the same server as the Exchange server.  If needed, let's call the server holding this code "InternalASPServer", and the exchange server is "ExchServer1".

Here is the relevant code of the function:

sub LateRegistration(classID, classDate, name, courseName, courseLocation, userEmail)

	dim mail, message	

                                                            
        message = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN""><html><body><table>" _& "<tr><td>Class:</td><td>" & courseName & "</td>" _& "<tr><td>City:</td><td>" & courseLocation & "</td>" _& "<tr><td>Date:</td><td>" & classDate & "</td>" _& "<tr><td>Student added:</td><td>" & name & "</td>" & "<br><br>Web Interface</body></html>" 
		Set mail = server.CreateObject("CDO.MESSAGE")
		if userEmail = "" then
			userEmail = "myemail@ourdomain.com"
		end if

		
		mail.From = userEmail
			
				mail.CC = userEmail
		
		mail.To = "testemail@ourdomain.com"
		mail.Subject = "Registration - Add Student"		
		mail.HTMLBody = message
		mail.Send 
		Response.Write "<br><b>Registration email sent.</b>"                  
	end if		
end sub

This code, while we were using Exchange 2003, did actually work.  To be honest, I don't know how it ever worked in the first place - it doesn't even reference our Exchange Server by name!  I don't know how it ever managed to actually achieve sending the email.

If we assume our Exchange 2013 server is named "ExchServer1", does anybody have suggestions on what needs to be done to this code, to actually send the email to our exchange server so that it is sent out?

Thank you very much for your time!


Viewing all articles
Browse latest Browse all 488

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>