So I've been moving some of my sites over. Why pay $5 a month (which is still cheap) when I can get hosting for pennies? I mean, $5 isn't much, but when you're hosting 11 sites, it adds up.
Many of the sites I host use contact forms or confirmation forms, or some other form that needs to send out an email. Simple enough, but I spent a good three hours this morning figuring out how to do it on GoDaddy, and not for the reason you think.....
Before I get to that, here's the code:
Replace the hardcoded values for subject, from, to etc. with your own values. Bear in mind GoDaddy will only send 250 messages a day, so if you need to do more, you'll have to come up with some other solution.sendUrl="http://schemas.microsoft.com/cdo/configuration/sendusing"
smtpUrl="http://schemas.microsoft.com/cdo/configuration/smtpserver"
' Set the mail server configuration
Set objConfig = CreateObject("CDO.Configuration")
objConfig.Fields.Item(sendUrl) = 2 ' cdoSendUsingPort
objConfig.Fields.Item(smtpUrl) = "relay-hosting.secureserver.net"
objConfig.Fields.Update
' Create and send the mail
Set objMail=CreateObject("CDO.Message")' Use the config object created above
Set objMail.Configuration = objConfig
objMail.From = "sender@coolexample.com"
objMail.To = "recipient@coolexample.com"
objMail.Subject = "subject"
objMail.TextBody = "body"
objMail.SendSet objSendMail = Nothing
Set objConfig = Nothing
Now here's the kicker. Two kickers, really:
The first is GoDaddy doesn't allow detailed error messages for classic ASP. All you get is a 500 Internal Server Error. I wasted a good bit of the three hours trying to figure out how to turn on errors but came up with nada. So good luck troubleshooting your ASP code....
And this is related to the above: I couldn't get the damn thing to work (and I couldn't see the error). So I ended up stepping through it line by line and guess what the problem was?
GoDaddy doesn't allow you to use a GMail address as a from address.
That's right my friends, Read it again.
So say you have a site with some sort of Send to a Friend thing where you ask for the sender's email, so the message says something like YourFriend@HisEmail.com has sent you a link and the from address is actually the person's email.
Well, if your address happens to be a GMail (and maybe other free mail apps, I didn't check) you get an error. An error that you can't troubleshoot.
Once I figured that out, the code worked fine, although I had to update some of my forms to change the sent from value so it didn't use the submittor's email address anymore.