Solved

Using the logged in username in the from field in a Frontpage form

Posted on 2004-09-27
18
346 Views
Last Modified: 2013-12-24
Hi

I am using Frontpage 2000 on a Windows 2000 worstation to administer a web for my IT group.  I have a few forms on this web that are sent to my email address.  To get my forms to send, I had to setup an the web's default email address in IIS under the server extensions (I used our general email "PCSupport-Corp").

This works just fine, however I would really like it if the emails could come from the user that is using the site.  Is there a way to do this?

NOTE: I am not a domain admin, and I don't have any special privledges.  I also cannot have the web administered from a server.  I have the permissions in Frontpage setup with each person from my group with browse capability.

Any help is appreciated as this will make my job a lot easier and I will be able to create forms that are sent to other departments if I can get this to work.

Thanks
EDH
0
Comment
Question by:edh-home
  • 6
  • 5
  • 5
  • +1
18 Comments
 
LVL 29

Accepted Solution

by:
coreybryant earned 500 total points
ID: 12164218
There is a way using scripts but not with FP. Do you know if you have CDONTs, JMAil, ASPMail, ASPEMail installed?

-Corey
0
 
LVL 14

Expert Comment

by:alimu
ID: 12165419
If you can get Request.ServerVariables("LOGON_USER") into the form field then that will pull the currently logged on user - may require some hand coding to do.
0
 
LVL 14

Expert Comment

by:alimu
ID: 12165442
just an addition to my last comment (hit submit too fast :)   )
your form submission page will probably need to be saved as an asp page.
your authentication type for this page will probably need to be either integrated or basic to make the user authenticate or it's not going to pull back anything of use.  
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Expert Comment

by:edh-corp
ID: 12166025
hey Corey

I dont have any of those installed.

hey alimu
where would I enter the Request.ServerVariables("LOGON_USER")?  also, my forms are htm files, can i just rename these to .asp?  and i am new to all of this so would it be possible for you to give me an example of what i need to do?

and to both of you, i think that i should mention that these forms will be sent from all MS OS's ranging from win95 - winXP.

thanks
EDH
0
 
LVL 14

Expert Comment

by:alimu
ID: 12166336
You should be able to just rename a htm file as an asp file to test this out (as long as asp's functional on your web server)

If you want to test that pulling the field out will work, create a little asp page containing the following code:
<%@LANGUAGE="VBScript"%>
<html>
<body>
<%Response.Write("LOGON_USER: " & Request.ServerVariables("LOGON_USER")) %>
</body>
</html>

For the form itself, just create yourself a field as per usual and then go into the html view and edit the field as you desire to pull the userid.  
The example below uses a hidden form field - you can work with it but the user won't see it in their view of the form:
<input type="hidden" name="uid" value="<%=Request.ServerVariables("LOGON_USER")%>">
0
 
LVL 29

Expert Comment

by:coreybryant
ID: 12166373
You can only use the hidden input field like alimu suggested - but for what you orginally wanted to do, FP cannot handle.  You need a form handler to process the form (other than FP).  It really does not matter all that much where they will be sent from since it is the server that is processing the form.

-Corey
0
 
LVL 14

Expert Comment

by:alimu
ID: 12166414
true - I still haven't resolved your question and frontpage will keep sending with your pre-configured server email address as the sender...
how about pulling the LOGON_USER into the body of the message - would that be enough?
0
 

Expert Comment

by:edh-corp
ID: 12173493
Actually, FP pulls the userID for me automatically already.  And I have that sent to me with the form data, however I do need to change who the email is coming from to the user that is logged into the page.
0
 
LVL 14

Expert Comment

by:alimu
ID: 12175495
this may not be possible using frontpage without one of Corey's suggestions for alternate applications tied in.  The server will usually have a set "sender address" for smtp mail otherwise.  
0
 

Author Comment

by:edh-home
ID: 12179051
Hey Corey

I've installed ASPEmail.  Could you give me an example or walkthrough of how I would capture the NT login name and use it as the FROM in the forms that are emailed from my site by using ASPEmail?

Thanks
0
 
LVL 29

Expert Comment

by:coreybryant
ID: 12179298
Actually, alimu already did:
<input type="hidden" name="uid" value="<%=Request.ServerVariables("LOGON_USER")%>">

And then you should be able to use LOGON_USER in the correct tag on the processing site.   I am not too familiar with the ASPEmail code, but I am sure it is somewhat the same as jmail.

-Corey
0
 

Author Comment

by:edh-home
ID: 12182792
oh and I would be willing to use jmail instead if you could give steps to get it to work with that :-)
0
 
LVL 29

Expert Comment

by:coreybryant
ID: 12182911
Well somewhat.  But I looked at the sample coding for ASPEmail:
<%
      ' change to address of your own SMTP server
      strHost = "smtp.broadviewnet.net"

      If Request("Send") <> "" Then
            
            Set Mail = Server.CreateObject("Persits.MailSender")
            ' enter valid SMTP host
            Mail.Host = strHost

            Mail.From = Request("From") ' From address
            Mail.FromName = Request("FromName") ' optional
            Mail.AddAddress Request("To")
            
            ' message subject
            Mail.Subject = Request("Subject")
            ' message body
            Mail.Body = Request("Body")

            strErr = ""
            bSuccess = False
            On Error Resume Next ' catch errors
            Mail.Send      ' send message
            If Err <> 0 Then ' error occurred
                  strErr = Err.Description
            else
                  bSuccess = True
            End If
      End If
%>

<HTML>
<HEAD>
<TITLE>AspEmail: Simple.asp</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">

<H2>AspEmail: Simple.asp</h2>

<% If strErr <> "" Then %>
<h3><FONT COLOR="#FF0000">Error occurred: <I><% = strErr %></I></FONT></h3>
<% End If %>

<% If bSuccess Then %>
<h3><FONT COLOR="#00A000">Success! Message sent to <% = Request("To") %>.</FONT></h3>
<% End If %>

<FORM METHOD="POST" ACTION="Simple.asp">

<TABLE CELLSPACING=0 CELLPADDING=2 BGCOLOR="#E0E0E0">
      <TR>
            <TD>Host (change as necessary in script):</TD>
            <TD><B><% = strHost %></B></TD>
      </TR>
      <TR>
            <TD>From (enter sender's address):</TD>
            <TD><INPUT TYPE="TEXT" NAME="From"></TD>
      </TR>
      <TR>
            <TD>FromName (optional, enter sender's name):</TD>
            <TD><INPUT TYPE="TEXT" NAME="FromName"></TD>
      </TR>
      <TR>
            <TD>To: (enter one recipient's address):</TD>
            <TD><INPUT TYPE="TEXT" NAME="To"></TD>
      </TR>
      <TR>
            <TD>Subject:</TD>
            <TD><INPUT TYPE="TEXT" NAME="Subject"></TD>
      </TR>
      <TR>
            <TD>Body:</TD>
            <TD><TEXTAREA NAME="Body"></TEXTAREA></TD>
      </TR>
      <TR>
            <TD COLSPAN=2><INPUT TYPE="SUBMIT" NAME="Send" VALUE="Send Message"></TD>
      </TR>

</TABLE>

</FORM>

</BODY>
</HTML>

The Mail.From = Request("From") ' From address - I did not see the Sender Name.  Someone might know that one.  On Jmail, I use:
JMail.Sender = Request.Form("EMail")
JMail.SenderName = Request.Form("Name")

-Corey
0
 

Author Comment

by:edh-home
ID: 12203007
OK.

So I installed ASPEmail and I tried their sample asp page.  After a bit of fighting with the SMTP server, I got mail to send.  Then I added the line from capturing the logged in user.  It works fine on the sample.

Now, on my actuall forms I have several text boxes and checkboxes.  How do I get this information to send in the email?  Can I just add the ASPEmail code to my existing forms or should I recreate the forms?

And since I am using ASP, can I also save this data in another format too (like txt files)?

Thanks for all your help so far
0
 
LVL 29

Expert Comment

by:coreybryant
ID: 12203062
Well yes, you should be able to add the ASPEMail code to your existing form.   Usually, I have a confirmation page - and that has all the:
<%
     ' change to address of your own SMTP server
     strHost = "smtp.broadviewnet.net"

     If Request("Send") <> "" Then
         
          Set Mail = Server.CreateObject("Persits.MailSender")
          ' enter valid SMTP host
          Mail.Host = strHost

          Mail.From = Request("From") ' From address
          Mail.FromName = Request("FromName") ' optional
          Mail.AddAddress Request("To")
         
          ' message subject
          Mail.Subject = Request("Subject")
          ' message body
          Mail.Body = Request("Body")

          strErr = ""
          bSuccess = False
          On Error Resume Next ' catch errors
          Mail.Send     ' send message
          If Err <> 0 Then ' error occurred
               strErr = Err.Description
          else
               bSuccess = True
          End If
     End If
%>
coding on that confirmation page.  But you can do it either way.  

And yes, you can save the data in another format as well.

-Corey
0
 

Author Comment

by:edh-home
ID: 12203534
ok i guess i understand that, how do i get results from textboxes and checkboxes to send in this type of email?
0
 
LVL 29

Expert Comment

by:coreybryant
ID: 12203709
I have to defer that over to someone else.  I know in JMail, I DIM the inputs & then write some code.  It is more than likely about the same.

You might also look here:
http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_20868843.html
http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_20912779.html

-Corey
0
 

Author Comment

by:edh-home
ID: 12203757
Ok well I have figure that part out.  I have been using the sample form from ASPEmail to play around with and add fields to.  Adding the ASPEmail code to my forms doesn't work.  I click submit and the form clears and doesnt send an email.  And when I am using the sample form, it sends me 2 emails.  one immediatly and one 2 minutes later with the same info.

Corey... I want to thank you for your help and I am accepting your original answer :-)

EDH
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem to master page 11 78
How do I use iTextSharp to turn my current page into a .pdf? 14 704
About Wordpress website 3 112
you tube .com 2 206
Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question