• 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

    • Not having this for personal accounts is silly IMO.
    • Direct messaging is finally making its way to Threads by David Uzondu Meta has announced it will finally begin testing direct messages on Threads, claiming that it was a "top request" since the platform's big splash in July 2023. This has been a massive pain point for users. For nearly a year, attempting to have a private conversation meant awkwardly fumbling over to a linked Instagram account, which for some people, completely killed the experience of actually using the app. Head of Instagram Adam Mosseri acknowledged this, stating "we know how important messaging is" to the platform's mission. It makes sense; a social network without a private messaging feature feels incomplete, especially when it is trying to supplant X. The initial test for this overdue feature is now rolling out to a limited number of people in Hong Kong, Thailand, and Argentina, with a wider release planned for later. For serious users and creators who hate having to send people to other apps like Instagram for DMs, this is fantastic news. For others, it's just one more inbox to check. Users included in the test will spot a new envelope icon on the main navigation bar, located at the bottom on mobile and on the left-side menu on the desktop site. The company, in typical fashion, has not offered a concrete timeline on when everyone else gets access, only saying it will expand "soon". In related news, Threads recently migrated its web presence from the old threads.net address to the much cleaner threads.com domain. That old domain was a leftover from the launch because Meta did not actually own the .com version, which was later scooped up. This change came alongside a cluster of other improvements to the web app, including a pop-up post composer that follows you as you scroll and provides easier access to your saved and liked posts.
    • Generally, Earth never initiated that animals lay straight
    • Several UI improvements masquerading as a major update. I'm truly hating this trend.
    • OpenAI to use Google Cloud despite rivalry, diversifying beyond Microsoft by Paul Hill To help it meet its massive computing demands for training and deploying AI models, OpenAI is looking into a surprising partnership with Google Cloud to use its services. It was widely seen that OpenAI was Google’s biggest threat, but this deal puts an end to the idea that the pair are purely competing. The two companies haven’t made any public announcement about the deal but a source speaking to Reuters claimed that talks had been ongoing for a few months before a deal was finalized in May. Notably, such a deal would see OpenAI expand its compute sources beyond Microsoft Azure. Microsoft had arrangements in place with OpenAI since 2019 that gave it the exclusive right to build new computing infrastructure for the startup. This limitation was loosened earlier this year with the announcement of Project Stargate. OpenAI is now allowed to look elsewhere for compute if Microsoft is unable to meet the demand. A win for Google Cloud, a challenge for Google's AI strategy The deal will see Google Cloud supply computing capacity for OpenAI’s AI model training and inference. This is a big win for Google’s Cloud unit because OpenAI is a massive name in AI and it lends credence to Google’s cloud offering. It also justifies Google Cloud’s expansion of its Tensor Processing Units (TPUs) for external use. On the back of the news, Alphabet’s stock price rose 2.1%, while Microsoft’s sank 0.6%, showing investors think it’s a good move for Google too. While many end users don’t interact with Google Cloud the same way they do with something like Android or Chrome, Cloud is actually a huge part of Google’s business. In 2024, it comprised $43 billion (12%) of Alphabet’s total revenue. With OpenAI as a customer, this figure could rise even more given the massive amounts of compute OpenAI needs. By leveraging Google’s services, it will also give OpenAI access to the search giant’s Tensor Processing Units (TPUs). Unlike GPUs, these chips are specifically designed to handle the kinds of calculations that are most common in AI and machine learning, leading to greater efficiency. Google’s expansion of these chips to external customers has already helped it attract business from Anthropic and Safe Superintelligence. While Google will happily take OpenAI’s money, it needs to tread carefully giving compute power to a rival, which will only make OpenAI more of a threat to Google’s search business. Specifically, it’ll need to manage how resources are allocated between Google’s own AI projects and its cloud customers. Another issue is that Google has been struggling to keep up with the overall demand for cloud computing, even with its own TPUs, according to its Chief Financial Officer in April. By giving access to OpenAI, it means even more pressure. Hopefully, this will be short lived as companies compete to build out capacity to attract customers. OpenAI's push for compute independence Back in 2019 when Microsoft became OpenAI’s exclusive cloud partner in exchange for $1 billion, the AI landscape was much different. End users wouldn’t have access to ChatGPT for another 3 years and the rate of development of new models was less ferocious than it is today. As OpenAI’s compute needs evolve, its relationship with Microsoft has had to evolve too, including this deal with Google and the Stargate infrastructure program. Reuters said that OpenAI’s annualized run rate (the amount they’ll earn in one year at its current pace) had surged to $10 billion, which highlights its explosive growth and need for more resources than Microsoft alone can offer. To make itself more independent, OpenAI has also signed deals worth billions of dollars with CoreWeave, another cloud compute provider, and it is nearing the finalization of the design of its first in-house chip, which could reduce its dependency on external hardware providers altogether. Source: Reuters
  • Recent Achievements

    • Enthusiast
      computerdave91111 went up a rank
      Enthusiast
    • Week One Done
      Falisha Manpower earned a badge
      Week One Done
    • One Month Later
      elsa777 earned a badge
      One Month Later
    • Week One Done
      elsa777 earned a badge
      Week One Done
    • First Post
      K Dorman earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      535
    2. 2
      ATLien_0
      272
    3. 3
      +FloatingFatMan
      201
    4. 4
      +Edouard
      200
    5. 5
      snowy owl
      138
  • Tell a friend

    Love Neowin? Tell a friend!