Email Issues

Post here to discuss topics relate to the 4.x version for the ASP Football Pool software program. All support topics should go here.
Post Reply
User avatar
fbonani
Posts: 50
Joined: Thu Aug 15, 2019 12:07 pm

Email Issues

Post by fbonani »

I am using a free webhost to host my asp type football pool and the package does not include email server. It suggests redirecting the email to gmail and provides a link to set it up but the link is not valid.

Does anyone have any idea how I can use an smtp server from another domain to send my emails? Does anyone have any suggestions at all on how to send emails in my situation?

Any suggestions would be much appreciated.
User avatar
Stutgrtguy
Posts: 167
Joined: Sun Oct 20, 2013 3:54 pm
Location: Colorado

Re: Email Issues

Post by Stutgrtguy »

Email through the site can be tricky, I've had no success unless I use gmail.
remember to direct the email to "your email" thru the /includes/config file

Then in the /includes/email.asp file look for this. cut and paste it then replace the YOUR EMAIL and YOUR PASSWORD with your correct info.
Keep in mind I dont have the original code so just cut and paste all the way to the "end function %>"

Always make back ups before editing :)
Hope this helps

UPDATE - I made a major boo boo

be sure there is no spaces between
YOUR EMAIL@gmail.com

and
YOUR PASSWORD

it should be as an example

"Ilovefootball@gmail.com"
"123456passwordhere"

Code: Select all

	'--------------------------------------------------------------------------
	' Sends an email and returns an empty string if successful. Otherwise, it
	' returns the error message.
	'--------------------------------------------------------------------------
	function SendMail(toAddr, subjectText, bodyText)

		dim mailer
		dim cdoMessage, cdoConfig

		'Assume all will go well.
		SendMail = ""

		'Configure the message.
set cdoMessage = Server.CreateObject("CDO.Message")
set cdoConfig = Server.CreateObject("CDO.Configuration")
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
cdoConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
cdoConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
cdoConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
cdoConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
cdoConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "YOUR EMAIL@gmail.com"
cdoConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "YOUR PASSWORD"
cdoConfig.Fields.Update
set cdoMessage.Configuration = cdoConfig
		'Create the email.
		cdoMessage.From     = ADMIN_USERNAME & " <" & ADMIN_EMAIL & ">"
		cdoMessage.To       = toAddr
		cdoMessage.Subject  = subjectText
		cdoMessage.HTMLBody = bodyText

		'Send it.
		on error resume next
		cdoMessage.Send

		'If an error occurred, return the error description.
		if Err.Number <> 0 then
			SendMail = Err.Description
		end if

		'Clean up.
		set cdoMessage = Nothing
		set cdoConfig  = Nothing

	end function %>
Last edited by Stutgrtguy on Thu Aug 29, 2019 7:27 pm, edited 2 times in total.
User avatar
Stutgrtguy
Posts: 167
Joined: Sun Oct 20, 2013 3:54 pm
Location: Colorado

Re: Email Issues

Post by Stutgrtguy »

a side note to this, many of my users get mad because gmail goes to their spam folders :/ so inform them
User avatar
fbonani
Posts: 50
Joined: Thu Aug 15, 2019 12:07 pm

Re: Email Issues

Post by fbonani »

I've made your suggested changes Stutgrtguy and I guess I will find out if the email module works when someone registers. I thought there was a way to send emails to individual players but if there is one, I can't seem to find it.
User avatar
Stutgrtguy
Posts: 167
Joined: Sun Oct 20, 2013 3:54 pm
Location: Colorado

Re: Email Issues

Post by Stutgrtguy »

you can, under admin login goto admin/email players. You can test it by emailing yourself to a different email addy.

But for this to happen a person must have an email addy in their profile. so in above example you should have an email addy in your profile other than the gmail you use for the site, then use the email players screen to email yourself. Be sure to check spam folder .... :)
User avatar
fbonani
Posts: 50
Joined: Thu Aug 15, 2019 12:07 pm

Re: Email Issues

Post by fbonani »

That's the problem then...I don't have an "Email Players" link under Administration after logging as the Admin. I also don't see an option in config.asp to set it. What am I missing?
User avatar
Stutgrtguy
Posts: 167
Joined: Sun Oct 20, 2013 3:54 pm
Location: Colorado

Re: Email Issues

Post by Stutgrtguy »

This in the /includes/config.asp file

'Site URL, used for the emails sent to users.
const POOL_URL = "http://www.yourdomain.com/"
is your domain name

'Administrator email address.
const ADMIN_EMAIL = "YOUREMAIL@gmail.com"
is the gmail addy you use

'Flag indicating whether the server can send email or not.
const SERVER_EMAIL_ENABLED = TRUE
must be set to = TRUE

Code: Select all


	'This code must run first.
	option explicit
	Response.Buffer = true

	'--------------------------------------------------------------------------
	' Site settings.
	'--------------------------------------------------------------------------

	'Session timeout (in minutes).
	const SESSION_TIMEOUT = 240

	'Site URL, used for the emails sent to users.
	const POOL_URL = "http://www.yourdomain.com/"

	'Page title.
	const PAGE_TITLE = "Yourtitle"

	'Administrator email address.
	const ADMIN_EMAIL = "YOUREMAIL@gmail.com"

	'Flag indicating whether the server can send email or not.
	const SERVER_EMAIL_ENABLED = TRUE
	
User avatar
Stutgrtguy
Posts: 167
Joined: Sun Oct 20, 2013 3:54 pm
Location: Colorado

Re: Email Issues

Post by Stutgrtguy »

http://philwojo.com/ASP_Football_Forum_ ... gmail#p761

Some issues I dealt with years ago in case I didn't solve yer problem
User avatar
fbonani
Posts: 50
Joined: Thu Aug 15, 2019 12:07 pm

Re: Email Issues

Post by fbonani »

Yes, SERVER_EMAIL_ENABLED is set to true in the config file and when I added your suggested code using the gmail smtp information, I get the following error message when trying to send it. The transport failed to connect to the server.

I found some code that Mike Hall put together a while back called sendEmailAll.asp which is a modified form used in the editNews.asp file. That is what am using which generates the above referenced error message.
User avatar
fbonani
Posts: 50
Joined: Thu Aug 15, 2019 12:07 pm

Re: Email Issues

Post by fbonani »

After repeated attempts and my authorization to google to allow access from this server, the emails are being sent and received. I used the code listed in this thread. Thanks to everyone for all the help.
User avatar
Stutgrtguy
Posts: 167
Joined: Sun Oct 20, 2013 3:54 pm
Location: Colorado

Re: Email Issues

Post by Stutgrtguy »

:)
Post Reply