• 0

ASP Help?


Question

I'm tryin to make this Sendmail code to send the result of a form to an e-mail, kinda like a contact form. Its been a long time since I've done this and i've lost my touch. could someone help me out?

<%
 ?Dim email, name, age, grade, address, phone, email, mom, dad
 ?Dim Mailer
 ?
 ?Set Mailer = Server.CreateObject("SMTPsvg.Mailer") ?'create Mailer object
 ?email = Request.QueryString("email") ? ' Get e-mail from querystring/form
 ?name = Request.QueryString("frstname") & " " Request.QueryString("lstname") ' Get name from querystring/form
 ?age = Request.QueryString("age")
 ?
 ?Mailer.FromName ? = name ?
 ?Mailer.FromAddress= "contactus@lala.com
 ?Mailer.RemoteHost = "smtp.lala.com" ?'Name of your mail host
 ?Mailer.AddRecipient "LALA Employee", personatthrive@lala.com 'Recipient
 ?Mailer.Subject ? ?= "Contact E-mail"
 ?Mailer.BodyText ? = "E-mail : " & email & "Name: " & name
 ?Mailer.SendMail ?'Send mail
 ?Set Mailer = Nothing
%>

That isn't complete, but I'm confused of where to go from there. It supposed to send the following fields to an e-mail, either formated with HTML or plain text

Fields:

First Name

Last Name

Age

Grade

Address

City

State

Zip

Phone

E-Mail

Mother's Name

Father's Name

Programs (Array of 6)

Thanks

splendore0@msn.com

Link to comment
https://www.neowin.net/forum/topic/279433-asp-help/
Share on other sites

11 answers to this question

Recommended Posts

  • 0
  Vafer1 said:
I'm tryin to make this Sendmail code to send the result of a form to an e-mail, kinda like a contact form. Its been a long time since I've done this and i've lost my touch. could someone help me out?

<%
  Dim email, name, age, grade, address, phone, email, mom, dad
  Dim Mailer
  
  Set Mailer = Server.CreateObject("SMTPsvg.Mailer")  'create Mailer object
  email = Request.QueryString("email")   ' Get e-mail from querystring/form
  name = Request.QueryString("frstname") & " " Request.QueryString("lstname") ' Get name from querystring/form
  age = Request.QueryString("age")
  
  Mailer.FromName   = name  
  Mailer.FromAddress= "contactus@lala.com
  Mailer.RemoteHost = "smtp.lala.com"  'Name of your mail host
  Mailer.AddRecipient "LALA Employee", personatthrive@lala.com 'Recipient
  Mailer.Subject    = "Contact E-mail"
  Mailer.BodyText   = "E-mail : " & email & "Name: " & name
  Mailer.SendMail  'Send mail
  Set Mailer = Nothing
%>

That isn't complete, but I'm confused of where to go from there. It supposed to send the following fields to an e-mail, either formated with HTML or plain text

Fields:

First Name

Last Name

Age

Grade

Address

City

State

Zip

Phone

E-Mail

Mother's Name

Father's Name

Programs (Array of  6)

Thanks

splendore0@msn.com

585397104[/snapback]

You need to get the Form information from the Request object's Form collection. Then you can access the Form's fields by name/id.

Link to comment
https://www.neowin.net/forum/topic/279433-asp-help/#findComment-585397901
Share on other sites

  • 0

It's the same most of the time, if you are sending it to a webmail based system like Hotmail, it automatically will strip that part and just display the <BODY>, in Outlook and those ones, the complete file is parsed with <HTML> existing or not, so I recommend you to send a complete <HTML> document and if you are putting CSS styles in the mail put them to be inline because most of the time the <HEAD> part is stripped out in websystems and local ones..

Link to comment
https://www.neowin.net/forum/topic/279433-asp-help/#findComment-585414104
Share on other sites

  • 0

ANYONE see anything wrong?

[/code]<% Dim email, name, age, grade, addy, phone, email, mom, dad

Dim Mailer

Set Mailer = Server.CreateObject("SMTPsvg.Mailer") 'create Mailer object

email = Request.QueryString("email") ' Get e-mail from querystring/form

' name = Request.QueryString("frstname") & " " 'Request.QueryString("lstname") ' Get name from querystring/form

' age = Request.QueryString("age")

Mailer.FromName = "Jeff Greener"

Mailer.FromAddress= "contactus@lala.com"

Mailer.RemoteHost = "smtp.cox.net" 'Name of your mail host

Mailer.AddRecipient "LALA Employee", "splendore0@msn.com" 'Recipient

Mailer.Subject = "Contact E-mail"

Mailer.BodyText = "<html>

<head>

<title>E-Mail from website </title>

</head>

<body>

<p>First Name: " & frstname & "<br>

Last Name: " & lstname & "<br>

Age: " & age &"<br>

Grade: " & grade & "<br>

Address: " & addy & "<br>

City: " & city & "<br>

State: " & state & "<br>

Zip: " & zip & "<br>

Phone: " & phone &"<br>

E-Mail: " & email & "<br>

Mother's Name: " & mname & "<br>

Father's Name: " & fname & "</p>

</body>

</html>"

Mailer.SendMail 'Send mail

Set Mailer = Nothing

%>


I can't figure it out, i thought i was doing it right but i think im wrong....

Link to comment
https://www.neowin.net/forum/topic/279433-asp-help/#findComment-585437534
Share on other sites

  • 0

The biggest problem with this is that you cannot have line breaks within your body text.

You can do:

Mailer.BodyText = "&lt;html&gt;&lt;head&gt;&lt;title&gt;E-Mail from website &lt;/title&gt;&lt;/head&gt;&lt;body&gt;..." 

so that the body text is all on one line.

OR

you can do:

Dim strBody

strBody = ""
strBody = strBody "&lt;html&gt;"
strBody = strBody "  &lt;head&gt;"
strBody = strBody "    &lt;title&gt;E-Mail from website &lt;/title&gt;"
strBody = strBody "  &lt;/head&gt;"
strBody = strBody "  &lt;body&gt;"... 

Mailer.BodyText = strBody

Try this and let me know if this work or if you are still encountering problems.

Link to comment
https://www.neowin.net/forum/topic/279433-asp-help/#findComment-585439706
Share on other sites

  • 0

&lt;% Dim email, name, age, grade, addy, phone, email, mom, dad
 Dim Mailer

 Set Mailer = Server.CreateObject("SMTPsvg.Mailer")  'create Mailer object
 email = Request.QueryString("email")   ' Get e-mail from querystring/form
 name = Request.QueryString("frstname") &amp; " " Request.QueryString("lstname") ' Get name from querystring/form
 age = Request.QueryString("age")


 Mailer.FromName   = name  
 Mailer.FromAddress= "contactus@lala.com"
 Mailer.RemoteHost = "smtp.cox.net"  'Name of your mail host
 Mailer.AddRecipient "LALA Employee", "splendore0@msn.com" 'Recipient
 Mailer.Subject    = "Contact E-mail"
 Mailer.BodyText   = "&lt;html&gt;&lt;head&gt;&lt;title&gt;E-Mail from website &lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;First Name: " &amp; frstname &amp; "&lt;br&gt;Last Name: " &amp; lstname &amp; "&lt;br&gt;Age: " &amp; age &amp;"&lt;br&gt;Grade: " &amp; grade &amp; "&lt;br&gt;Address: " &amp; addy &amp; "&lt;br&gt;City: " &amp; city &amp; "&lt;br&gt;State: " &amp; state &amp; "&lt;br&gt;Zip: " &amp; zip &amp; "&lt;br&gt;Phone: " &amp; phone &amp;"&lt;br&gt;E-Mail: " &amp; email &amp; "&lt;br&gt;Mother's Name: " &amp; mname &amp; "&lt;br&gt;Father's Name: " &amp; fname &amp; "&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;"
 Mailer.SendMail  'Send mail
 Set Mailer = Nothing
%&gt;

Whats wrong now? still server error, could it be the content type? anyone remember the mailer. extension for it?

Link to comment
https://www.neowin.net/forum/topic/279433-asp-help/#findComment-585454018
Share on other sites

  • 0

Your missing an "&" between the " " and Request.QueryString("lstname") :

 name = Request.QueryString("frstname") &amp; " " Request.QueryString("lstname")

Should be:

 name = Request.QueryString("frstname") &amp; " " &amp; Request.QueryString("lstname")

If this still doesn't fix it, do you know what the error is or are you just getting the "Page Cannot Be Displayed Error?" If the latter, than have you tried injecting any error catching to display where the error might be occuring?

Oh, try adding this code to catch any smpt errors:

 Mailer.SMTPLog = "c:\smtplog.txt"

Link to comment
https://www.neowin.net/forum/topic/279433-asp-help/#findComment-585458350
Share on other sites

  • 0

I am getting ERROR 500, internal server error. Put that fix in and still doesnt work..

Does anyone have the resources to test this page on their site?

And the smptlog doenst create even after changing permissions,

THis is all my server log says...

[sat Feb 12 21:59:52 2005] [error] [client 68.98.23.118] File does not exist: /home/kentco2/public_html/500.shtml

[sat Feb 12 21:58:57 2005] [error] [client 68.98.23.118] File does not exist: /home/kentco2/public_html/500.shtml

[sat Feb 12 21:58:57 2005] [error] [client 68.98.23.118] File does not exist: /home/kentco2/public_html/404.shtml

and yes ASP is enabled.

Link to comment
https://www.neowin.net/forum/topic/279433-asp-help/#findComment-585461999
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Lol, sounds like you're not up to date with reality and are just repeating what the salesman told ya. Here's a little insight for you: Electric Cars Are Way Less Reliable Than ICE Cars, Says Consumer Reports. Alas, you're entitled to your wrong opinion.
    • misleading its one word to describe what M$ have done, windows 10 perform better on older hardware and even on new hardware sometimes, windows 11 its a mess and no one want to use it for many good reasons, until they listen its customers read the feedback hub comments and maybe backoff its forced requiremens, they are having a vista and 8 moment.
    • Media Player Classic - Home Cinema 2.5.0 by Razvan Serea Media Player Classic - Home Cinema (MPC-HC) is a free and open-source video and audio player for Windows. MPC-HC is based on the original Guliverkli project (which is no longer maintained) and contains many additional features and bug fixes. As the continuation of the original Media Player Classic, MPC-HC isn’t flashy but it works with nearly any media format. MPC-HC uses DXVA technology to pass decoding operations to your modern video card, enhancing your viewing experience. And MPC-HC supports both physical and software DVDs with menus, chapter navigation, and subtitles. Overview of features A lot of people seem to be unaware of some of the awesome features that have been added to MPC-HC in the past years. Here is a list of useful options and features that everyone should know about: Dark interface Menu > View > Dark Theme When using dark theme it is also possible to change the height of the seekbar and size of the toolbar buttons. Options > Advanced Video preview on the seekbar Options > Tweaks > Show preview on seek bar Adjust playback speed Menu > Play > Playback rate The buttons in the player that control playback rate take a 2x step by default. This can be customized to smaller values (like 10%): Options > Playback > Speed step Adjusting playback speed works best with the internal audio renderer. This also has automatic pitch correction. Options > Playback > Output > Audio Renderer MPC-HC can remember playback position, so you can resume from that point later Options > Player > History You can quickly seek through a video with Ctrl + Mouse Scrollwheel. You can jump to next/previous file in a folder by pressing PageUp/PageDown. You can perform automatic actions at end of file. For example to go to next file or close player. Options > Playback > After Playback (permanent setting) Menu > Play > After Playback (for current file only) A-B repeat - You can loop a segment of a video. Press [ and ] to set start and stop markers. You can rotate/flip/mirror/stretch/zoom the video Menu > View > Pan&Scan This is also easily done with hotkeys (see below). There are lots of keyboard hotkeys and mouse actions to control the player. They can be customized as well. Options > Player > Keys Tip: there is a search box above the table. You can stream videos directly from Youtube and many other video websites You can stream videos directly from Youtube and many other video websites Put yt-dlp.exe or youtube-dl.exe in the MPC-HC installation folder. Then you can open website URLs in the player: Menu > File > Open File/URL You can even download those videos: Menu > File > Save a copy Tip: to be able to download in best quality with yt-dlp/youtube-dl, it is recommended to also put ffmpeg.exe in the MPC-HC folder. Several YDL configuration options are found here: Options > Advanced This includes an option to specify the location of the .exe in case you don't want to put it in MPC-HC folder. Play HDR video This requires using madVR or MPC Video Renderer. After installation these renderers can be selected here: Options > Playback > Output Ability to search for and download subtitles, either automatically or manually (press D): Options > Subtitles > Misc Besides all these (new) features, there have also been many bugfixes and internal improvements in the player in the past years that give better performance and stability. It also has updated internal codecs. Support was added for CUE sheets, WebVTT subtitles, etc. Media Player Classic - Home Cinema 2.5.0 changelog: Updated LAV Filters to version 0.80-1-gb9116 Updated MPC Video Renderer to version 0.9.9.2400 Several small fixes and improvements. Graphics Designers Wanted for New Toolbar Buttons A new toolbar is planned for implementation in the player, featuring optional extra buttons and fully customizable layouts. As a result, existing custom toolbar designs will no longer be supported in the future. New button designs are needed, and contributions from graphics designers are welcome. Those interested in helping create the new toolbar are encouraged to read the dedicated information page. Download: MPC-HC 2.5.0 (x64) | Standalone | ~20.0 MB (Open Source) Download: MPC-HC 2.5.0 (x86) | Standalone Links: MPC-HC Home Page | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Then don't put it on an IoT VLAN but put it on your main, trusted, VLAN. If you put it on a different VLAN you lose printer discovery.
    • For me it isn't usable because I'm a power user. I need Wayland but I also need remote desktop. VNC isn't a thing with Wayland and freeRDP isn't nearly ready enough yet either. If I was less demanding (didn't need remote desktop or ran Xorg) I would probably be fine.
  • Recent Achievements

    • Week One Done
      emptyother earned a badge
      Week One Done
    • Week One Done
      DarkWun earned a badge
      Week One Done
    • Very Popular
      valkyr09 earned a badge
      Very Popular
    • Week One Done
      suprememobiles earned a badge
      Week One Done
    • Week One Done
      Marites earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      570
    2. 2
      ATLien_0
      183
    3. 3
      +FloatingFatMan
      173
    4. 4
      Xenon
      124
    5. 5
      Michael Scrip
      117
  • Tell a friend

    Love Neowin? Tell a friend!