edh-home
asked on
Using the logged in username in the from field in a Frontpage form
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you can get Request.ServerVariables("L OGON_USER" ) into the form field then that will pull the currently logged on user - may require some hand coding to do.
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.
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.
hey Corey
I dont have any of those installed.
hey alimu
where would I enter the Request.ServerVariables("L OGON_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
I dont have any of those installed.
hey alimu
where would I enter the Request.ServerVariables("L
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
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_US ER: " & Request.ServerVariables("L OGON_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.ServerVa riables("L OGON_USER" )%>">
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_US
</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.ServerVa
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
-Corey
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?
how about pulling the LOGON_USER into the body of the message - would that be enough?
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.
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.
ASKER
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
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
Actually, alimu already did:
<input type="hidden" name="uid" value="<%=Request.ServerVa riables("L OGON_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
<input type="hidden" name="uid" value="<%=Request.ServerVa
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
ASKER
oh and I would be willing to use jmail instead if you could give steps to get it to work with that :-)
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("Persi ts.MailSen der")
' 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></T D>
</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
<%
' change to address of your own SMTP server
strHost = "smtp.broadviewnet.net"
If Request("Send") <> "" Then
Set Mail = Server.CreateObject("Persi
' 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></T
</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
ASKER
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
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
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("Persi ts.MailSen der")
' 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
<%
' change to address of your own SMTP server
strHost = "smtp.broadviewnet.net"
If Request("Send") <> "" Then
Set Mail = Server.CreateObject("Persi
' 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
ASKER
ok i guess i understand that, how do i get results from textboxes and checkboxes to send in this type of email?
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:
https://www.experts-exchange.com/questions/20868843/Jmail-Body.html
https://www.experts-exchange.com/questions/20912779/JMail.html
-Corey
You might also look here:
https://www.experts-exchange.com/questions/20868843/Jmail-Body.html
https://www.experts-exchange.com/questions/20912779/JMail.html
-Corey
ASKER
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
Corey... I want to thank you for your help and I am accepting your original answer :-)
EDH