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.

Share/Save/Bookmark
Signature

Comments

12/25/2007 3:13:41 PM #

Ajay

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 4:34:25 PM #

rtur.net

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

rtur.net |

2/20/2008 6:25:40 PM #

Adrian Vintu

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 12:41:47 PM #

rtur.net

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 2:33:31 PM #

Adrian Vintu

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/12/2008 5:03:33 AM #

Gary

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 10:17:04 PM #

rtur.net

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 |

6/6/2008 5:54:59 PM #

Adrienne

Ok call me stupid. I have been "trying" to put a form on my page for weeks now. I have read and re-read godaddy's instructions on the gdform.asp. I even called godaddy and actually I didn't get much help. I read in your post (October 10 - Make godaddy send your mail, that godaddy places or generates the gdform.asp into the root..is that right? I don't see it. Am I suppose to see it? I just don't get it. I set up my email. I did what the instructions said and I get a big ole "Opps!"

This is my first time using godaddy, in the past I have had all my hosting with Yahoo. And I am sure the code I used for Yahoo would be similar to what godaddy offers. (meaning placing a code into the form and having it directed through e-mail)

All I want to be able to do is having my customers be able to fill out forms. That's all I want. I am by no means and idiot, I am by no means an expert at codes and all that but I am usually able to understand really quick about this stuff. And I just don't get it.

Is the gdform.asp suppose to be something they place into my root directory? Am I suppose to place it in there myself? I know for my menu bars there was a script page specfically for my menu bar, and it's all just code, is that what the gdfrom is suppose to be like? (Not sure if that makes any sense.) are viewers suppose to go directly to for example. www.yourpage/gdforms.asp?  

I hope this is making some sort of sense to someone. Any help would be greatly appreciated

Adrienne |

6/6/2008 7:21:27 PM #

rtur.net

Adrienne,
GoDaddy will generate and put this little gdforms.asp file in your app's root directory after you go through step 1 of this post. Yes, it is just code - you can't go to this page and see any fields you need to fill up. For this to work, you actually need to create input form yourself like this:
1. Make sure you got step 1 right and have gdforms.asp in you site's root directory. You'll have to go to admin console and look at the list of files, going to "gdforms.asp" won't do it.
2. Create file "contact.htm", type in code shown in the picture and put it in the root of your site.
3. Go to "yoursite/contact.htm", you'll see a form with fields.
4. Type in a message and click "submit" button.
5. Email will be sent to the address you specified when you set up your "Form Mail", as described in the step 1.

rtur.net |

6/8/2008 6:43:48 AM #

Adrienne

Thanks so much I figured it out late last night. I started over (setting up the e-mail) and it worked like a charm. Before I did not see the coding but once I redid the e-mail steps it showed up right away. And was able to get the forms working.

Thanks for the response.

Adrienne

Adrienne |

7/15/2008 9:04:03 AM #

Peter Colless

Hi all... Im finding it a bit of a challenge to get my godaddy gdform.asp to work.
Ill explain what ive done then hopfully someone can correct me and set me in the right direction cause im doing something wrong.

im using dreamweaver.

1. I have created a form with action as "gdform.asp" and saved page as freegift.html
2. ive gone to godaddy and set up my email..
Smile from here im a little confuse??

ive read that godaddy sends a code to my root folder but i cannot see anything in my dreamweaver saved folder.

could someone PLEASE explain step by step from start to finish? I have read and researched so much but still cannot seem to grasp the idea of it.

cheers,
Pete

Peter Colless |

8/18/2008 1:05:25 PM #

tony shams

Hi guys,

I am trying to make dgform.asp to insert a linefeed/carriage return after each line that it sends -- the form when emailed has over 100 lines and I am  hoping to make it more legible.  But whatever I do I get no results.  I have added vbCrLf (and ControlChar.CrLf) to every part of the code that I thought it would help such as the OutputLine sub, FormatVariableLine function, concatenating a carriage return to the end of the "value" variable before it is passed to the above functions -- all to no avail.  Somehow they get stripped, do you have any ideas guys, really need your help please.

Thanks,
Tony

tony shams |

8/18/2008 2:23:38 PM #

rtur.net

Tony, email can be sent either as HTML or as plain text. If it is sent as HTML, vbCrLf's will be stripped off. You might try to use "<br/>" or "\n" instead or "vbCrLf".

rtur.net |

9/15/2008 7:50:31 PM #

Lou

Hey,

I can't get my code to work...when i click submit on my html form page it says no variables sent to form, what doe sthis mean? This is the form code:

  <form action="http://www.summertimeglobal.com/gdform.asp" method="post" enctype="text/plain" name="ContaktCompetition" target="_blank" id="ContaktCompetition">
      <input name="recipient" type="hidden" id="recipient" value="info@summertimeglobal.com" />
          <input name="subject" type="hidden" id="subject" value="Competition Entry" />
          <input name="redirect" type="hidden" id="redirect" value="http://www.summertimeglobal.com/index.html" />
          <span class="style15">
          <label for="YearsMinusCelebrates"><span class="style16">How many years does M-nus celebrate this year?</span></label>
          </span><br/>
          <br/>
        <div align="left">
                                    <select name="YearsMinusCelebrates" id="YearsMinusCelebrates">
                                                                <option selected="selected">Select from menu</option>
                                                                <option value="5years">5 years</option>
                                                                <option value="7years">7 years</option>
                                                                <option value="10years">10 Years</option>
                                                                </select>
            <br/>
                                    dwdd
                                    <span class="style11"></span></div>
        <div align="left"><span class="style9">Who is Plastikman?<br/>
            <br/>
          </span>
        <div align="left">
            <span class="style11">
            <select name="WhoIsPlastikman" id="WhoIsPlastikman">
              <option selected="selected">Select from menu</option>
              <option value="Marco Carola">Marco Carola</option>
              <option value="Sven Vath">Sven Vath</option>
              <option value="Richie Hawtin">Richie Hawtin</option>
            </select>
            </span></div>
        <span class="style11"><br/>
          <label for="WhoSufferedATheft"><span class="style15">Which M-nus artist suffered a theft n the last month?</span></label>
          <br/>
          <br/>
          <select name="WhoSufferedATheft" id="WhoSufferedATheft">
            <option>Select from menu</option>
            <option value="Richie Hawtin">Richie Hawtin</option>
            <option value="Gaiser">Gaiser</option>
            <option value="Magda">Magda</option>
          </select>
          <br/>
          <span class="style15"><br/>
          <label for="WhereRichieIsFrom">Where is Richie Hawtin from?</label>
          </span>
          <label for="WhereRichieIsFrom"></label>
          <br/>
          <br/>
          <select name="WhereRichieIsFrom" id="WhereRichieIsFrom">
            <option selected="selected">Select from menu</option>
            <option value="Detroit">Detroit (US)</option>
            <option value="Banbury">Banbury (UK)</option>
            <option value="Berlin">Berlin (DE)</option>
            <option value="Windsor">Windsor (CA)</option>
          </select>
          <br/>
          <br/>
          <br/>
          <label for="EmailAddress"><span class="style15">Email:</span></label>
          <span class="style15">&nbsp;&nbsp;&nbsp;</span><br/>
          <br/>
          <input name="EmailAddress" type="text" id="EmailAddress" size="25" />
          <br/>
          <br/>
          <input type="submit" name="submit" id="submit" value="Submit Entry!" />
          <br/>
        </span></div>
      </form>

I have set my action correctly and everything! Please help its driving me nuts! Thanks

Lou |

9/15/2008 9:22:39 PM #

rtur.net

@Lou, look at the picture in the post. It shows what fields standard html form should have. GoDaddy is looking for "FirstName", "LastName", "email", "comments" and can't find them in your form. You should either adjust your html form to have those fields, or GoDaddys .aspx file to process custom html page with different fields. I'd suggest you first try simple form shown in the picture and then change it to fit your needs.

rtur.net |

10/22/2008 10:25:56 AM #

jcrog

I am getting this error:

Error creating file! Directory may not be writable or may not exist.
Unable to process request.

Any idea why? All I did was add recipient and subject hidden fields.

<form action="gdform.asp" method="post">

<input class="input" name="yourname" type="text"/>
<img src="images/name.gif" alt="Your name" width="63" height="12" /><br />
<br />


<input class="input" name="email" type="text" />
<img src="images/email.gif" alt="Email" width="32" height="12" /><br />
<br />
<textarea class="textarea" name="message" cols="" rows=""></textarea>
<img src="images/message.gif" alt="Message" width="50" height="16" /><br />
<br /><br />
<input type="hidden" name="subject" value="Message Submission from simplyindigo.com" />
<input type="hidden" name="redirect" value="thanks.html" />
<div style="clear:both; margin-left:220px">
<input name="reset" type="reset" value="Reset" /> <input name="submit" type="submit" value="Submit" /></div>
</form>


here is the 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
%>

jcrog |

Comments are closed
<<  March 2010  >>
SuMoTuWeThFrSa
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910
Enhanced with Snapshots

Subscribe to Rtur.net