It seems a little odd that a windows server would have you do it in perl. I do mine with ASP using visual basic. here's a simple one with comments that possitively works, no matter what directory it's stored in (assumes your server supports ASP and since it's a Window's server, I would have to believe so - (directory permissions should be set for read and execute scripts - cgi-bin is probably already set that way so it's just as good a place to drop it as any.) (Save as a .asp page):
<%
SenderEmail = request.form ("email")
SenderName = request.form ("name")
Set JMail = Server.CreateObject("JMail.SMTPMail")
' This is my local SMTP server
JMail.ServerAddress = "mailhub.yoursmptserver.com"
' This is me....
JMail.SenderName = SenderName
JMail.Sender = SenderEmail
JMail.Subject = "Subscription Submission"
' Get the recipients mailbox from a form (note the lack of a equal sign).
JMail.AddRecipient "yourmail@wherever.com"
'JMail.AddRecipient "dad@some.com"
' The body property is bodth read and write.
' If you want to append text to the body you can
' use JMail.Body = JMail.Body & "Hello world!"
' or you can use JMail.AppendText "Hello World!"
' which in many cases is easier to use.
JMail.Body ="Name = " & request.form ("name") & vbCrLf&_
"Email Address = " & request.form ("email")
JMail.Priority = 3
JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
' Must make sure that IUSR_???? has access to the following files.
'JMail.AppendBodyFromFile "e:\mail\standard_footer.txt"
'JMail.AddAttachment "e:\products\MyProduct.exe"
' Send it...
JMail.Execute
Set JMail = nothing
%>
- <%
- SenderEmail = request.form ("email")
- SenderName = request.form ("name")
- Set JMail = Server.CreateObject("JMail.SMTPMail")
- ' This is my local SMTP server
- JMail.ServerAddress = "mailhub.yoursmptserver.com"
- ' This is me....
- JMail.SenderName = SenderName
- JMail.Sender = SenderEmail
- JMail.Subject = "Subscription Submission"
- ' Get the recipients mailbox from a form (note the lack of a equal sign).
- JMail.AddRecipient "yourmail@wherever.com"
- 'JMail.AddRecipient "dad@some.com"
- ' The body property is bodth read and write.
- ' If you want to append text to the body you can
- ' use JMail.Body = JMail.Body & "Hello world!"
- ' or you can use JMail.AppendText "Hello World!"
- ' which in many cases is easier to use.
- JMail.Body ="Name = " & request.form ("name") & vbCrLf&_
- "Email Address = " & request.form ("email")
- JMail.Priority = 3
- JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
- ' Must make sure that IUSR_???? has access to the following files.
- 'JMail.AppendBodyFromFile "e:\mail\standard_footer.txt"
- 'JMail.AddAttachment "e:\products\MyProduct.exe"
- ' Send it...
- JMail.Execute
- Set JMail = nothing
- %>
The html form is just as basic (Save as an HTML page):
<FORM method="POST" action="/cgi-bin/subscribeform.asp">
<input type="hidden" name="required" value="Name,SubscriberMail" />
Your Name:
<input tabindex="1" type="text" size="30" name="name" /><br />
Your Email:
<input tabindex="2" type="text" size="30" name="email" /><br />
<input tabindex="3" type="submit" value="Submit" title="Submit this form"><br />
</form>
- <FORM method="POST" action="/cgi-bin/subscribeform.asp">
- <input type="hidden" name="required" value="Name,SubscriberMail" />
- Your Name:
- <input tabindex="1" type="text" size="30" name="name" /><br />
- Your Email:
- <input tabindex="2" type="text" size="30" name="email" /><br />
- <input tabindex="3" type="submit" value="Submit" title="Submit this form"><br />
- </form>
That is a working model. Just change the Jmail.AddRecipient to your email address and change the Jmail.ServerAddress to your hosts SMPT server and it should work for you the first time, provided you can use ASP
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.