Remember those lazy days when you could kick your trustworthy CDONTS mail messages from anywhere inside juicy spaghetti code and it just worked? Well, those days are over. Even 1.x’s System.Web.Mail – also not a brainier to use – is outdated and big no-no our days.

Now we supposed to use SMTPW. And sometimes this beast just refuses to cooperate. Complete showstopper. I’m not a quitter, but I’m not going to spend countless hours googling around for the fix either (although, I admit, it is kind of addictive). So after short hunt, when first four or five “guaranteed” solutions did not work out I started looking for workaround.

Because I’m using GoDaddy, first I looked what they have to offer. Found another SMTP “solution” – nope, did not work either. Then there is a strange animal called “Form Mailer” – forums insisted that it is “classic” ASP only and does not work with ASP.NET. Fine. Or does it? I gave it a try. One of those days, I guess – everything is upside down. It worked. So, if you are in the same hole I’ve been for a while, there is how you can make GoDaddy send your emails (yes, even if your account .NET 2.0 only).

 

  1. Go to GoDaddy’s hosting account / control panel / content / form mail. Fill in email address you want “daddy” send your messages to and “enable” form mailer. It is simple wizard; all you need is to click “ok” couple times.
  2. GoDaddy will generate gdform.asp and put it in the root of your hosting account. The whole purpose of this .asp page is to parse form that invoked it and write data to the file. This file then will be picked up by scheduled job that will actually create and send email to address that you’ve set up in the step one.
  3. There are defined field names (or query string parameters) that you have to use. Sure, you can also change .asp script itself to use other names if you already have contact form in your application that you want to use, all you need is to submit form to gdform.asp. So, simple HTML form shown below will work just fine:

That’s it. You don’t have to set SSL, make sure your host port is not blocked by firewall, no configuring POP accounts, sending passwords back and force, adding stuff to your web.config and thousand other neat details that make SMTP look like can of worms. Ok, it may be a bit of a hack and security is somewhat questionable, may be. But till all that SMTP mess is fixed or dumbed down to my level – I’m going to use this one! Oh, and you don’t really have to use HTML page at all – you can even “send” mail this way from your business class, using ASP.NET request object. Although that will be a little bit more involving.

Signature

Related posts

Comments

12/25/2007 7:13:41 AM

Hi,
I am new to ASP.net world. My site is developed in ASP.net and not in HTML. please tell me what I need to do.

cheers,
Ajay

Ajay

12/25/2007 8:34:25 AM

Depends on your situation. Are you using existing application? Writing from scratch? What did you try so far?

rtur.net

2/20/2008 10:25:40 AM

maybe you are interested in my found solution
http://adrianvintu.com/blogengine/post/Send-mail-with-GoDaddy-and-Send-mail-with-BlogEnginenet.aspx

@out of the context:
do you have a spell check plug in for your BlogEngine.NET?

Adrian Vintu

2/21/2008 4:41:47 AM

maybe you are interested in my found solution
Actually, the very next post (just hit "SMTP with GoDaddy" link on top of this page) describes this same solution.
Spell checker should be for Tiny MCE if you are using default BE installation, not sure if there is one. Or you can use spell checker build into FireFox.

rtur.net

2/21/2008 6:33:31 AM

the funny thing is that I browsed a little bit your web, but did not see the linkSmile)

thanks for the tips on the spell check. I have no spell checking in my default BlogEngine installation and also the FF one is not working - I am talking about writing threads in my blog, not comments. for comments the FF works great, as usual. mystery...

cheersSmile

Adrian Vintu

Adrian Vintu

4/11/2008 9:03:33 PM

I have 5 websites that are in 1 hosting area on GoDaddy.
How do I setup the GDform.asp so it can retrieve mutiple e-mail accounts from different domain names. Working with just one domain name in the hosting this can be done but what about if I have more then one. I know the below gdform.asp and html file needs to be in each different domain folder so this will work. I have no ideal on how to figure this one. NEED HELP>>>



<html>
<head>
<title>My Site</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form action="gdform.asp" method="post">
<input type="hidden" name="subject" value="Form Test Submission">
<input type="hidden" name="redirect" value="thankyou.html">
<input TYPE="text" size="25" name="FistName">

<br>
<input TYPE="text" size="25" name="LastName">

<br>
<input TYPE="text" size="25" name="email">

<br>
<textarea name="comments" cols="40" rows="10"></textarea>
<input name="submit" type="submit" value="submit">
</form>

</body>
</html>
________________________________________________________________

this is godaddys gdform.asp


<%

Dim landing_page, host_url
Dim fso, outfile, filename, dirname, myFolder
Dim req_method, key, value
Dim bErr, errStr, bEmpty
On Error resume next
bErr = false
bEmpty = true
errStr = ""
Set fso = Server.CreateObject("Scripting.FileSystemObject")
host_url = Request.ServerVariables("HTTP_HOST")
req_method = Request.ServerVariables("REQUEST_METHOD")
dtNow = Now()
filename = Server.MapPath("ssfm")
dirname = filename
filename = filename & "/gdform_" & DatePart("M", dtNow) & DatePart("D", dtNow) & DatePart("YYYY", dtNow) & DatePart("N", dtNow) & DatePart("S", dtNow)

Function FormatVariableLine(byval var_name, byVal var_value)
Dim tmpStr
tmpStr = tmpStr & "<GDFORM_VARIABLE NAME=" & var_name & " START>" & vbCRLF
tmpStr = tmpStr & var_value & vbCRLF
tmpStr = tmpStr & "<GDFORM_VARIABLE NAME=" & var_name & " END>"
FormatVariableLine = tmpStr
end function

Sub OutputLine(byVal line)
outfile.WriteLine(line)
end sub

if err.number = 0 then
Set outfile = fso.CreateTextFile(filename, true, false)
if err.number <> 0 then
bErr = true
errStr = "Error creating file! Directory may not be writable or may not exist.<br>Unable to process request."
else
if(req_method = "GET") then
for each Item in request.QueryString
if item <> "" then
bEmpty = false
key = item
value = Request.QueryString(item)
if(lcase(key) = "redirect") then
landing_page = value
else
line = FormatVariableLine(key, value)
Call OutputLine(line)
end if
end if
next
elseif (req_method = "POST") then
for each Item in request.form
if item <> "" then
bEmpty = false
key = item
value = Request.form(item)
if(lcase(key) = "redirect") then
landing_page = value
else
line = FormatVariableLine(key, value)
Call OutputLine(line)
end if
end if
next
end if
outfile.close
end if
if(bEmpty = true) AND errStr = "" then
bErr = true
errStr = errStr & "<br>No variables sent to form! Unable to process request."
end if
if(bErr = false) then
if (landing_page <> "") then
response.Redirect "http://" & host_url & "/" & landing_page
else
response.Redirect "http://" & host_url
end if
else
Response.Write errStr
end if
set fso = nothing
else
Response.Write " An Error Occurred creating mail message. Unable to process form request at this time."
end if
%>

Gary

4/13/2008 2:17:04 PM

Gary, not sure if I follow your situation. Do you want mail go to 5 different mail boxes? Then you'll have set up 5 email accounts with GoDaddy and have gdform.asp in the root of every domain you are using. If you have only one account you might try to configure redirect in the mail section in GoDaddy admin, although I never tried it so it is just a guess.

rtur.net

Add comment


 

  Country flag

biuquoteimg
Loading



<<  May 2008  >>
SuMoTuWeThFrSa
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567
Enhanced with Snapshots

Subscribe to Rtur.net