Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Send Script for website...

Explorer ,
Oct 08, 2022 Oct 08, 2022

Hi Guys,

I want a send script that will submit a form from a website.

The code should be in Java or JavaScript or any other programming language.

The form on this website previously had a PHP send script that works, but the creators have now modified the code. Thanks, any ideas or suggestions will help.

TOPICS
Code
989
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 08, 2022 Oct 08, 2022

Why do you need java or javascript and what changed on the PHP code that no longer works?

 

If you just need a simple form builder something like Wufoo ( https://www.wufoo.com/ ) may work for you. Then there is no need to code or worrying about creators changing something that would make the form incompatible with your environment.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 08, 2022 Oct 08, 2022
I need them, because I am already familiar with using these two languages.
 
Answer to your question is that the complete PHP code no longer works.
Like you said, its worrying when creators change code that already works which makes it incompatible with my environment, wufoo may work for me as a simple form builder, but I have an existing webpage template that I already use, all I need to do is to code or paste a working code into this page, and am good to go. 
Thanks.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 08, 2022 Oct 08, 2022

If you are familiar with the languages, you know javascript cannot send the email but it can help validate your form.  You need a server-side script like PHP to process the data and mail it via the server.  There is the javamail API that can send out a form via java ( https://javaee.github.io/javamail/ ), and some instruction on how to use it ( https://www.digitalocean.com/community/tutorials/javamail-example-send-mail-in-java-smtp ) but it's not very common so I don't know of any scripts off hand that are pre-built to take advantage of this.

 

What script were you using?  Do you know exactly what made the update incompatible with your environment? Are they only supporting specific versions of PHP and your server does not support the update?  Do you know what your environment requires?  I think it would be easier to find a PHP script if you want to do it yourself without the builders than trying to find something written in java.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 08, 2022 Oct 08, 2022

I tried to find a PHP server-side script, anyone can get this on the PHP website, if you know where to look, not anymore thesedays, the code was robust and stable, this is the reason I used it for years, but obviously as you know creators change or rewrite code for whatever reason, without any prior warning for software developers and  users like me, but anyway I will try the Java Mail API, I dont know anybody using this, but I will give it a try.

 

Many thanks.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 08, 2022 Oct 08, 2022

Note that the JavaMail API requires the JavaBeans(TM) Activation Framework package to be installed.

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 08, 2022 Oct 08, 2022
quote

The code should be in Java or JavaScript or any other programming language.


By @smartCode

 

The programming language of the send mail script depends on the application server. As an example, for Java, the most popular is Apache Tomcat; for JavaScript, NodeJS/Express.

 

Before supplying the code, we will need to know which server it will apply to.

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 08, 2022 Oct 08, 2022

@smartCode,

Before you commit to ANYTHING, ask your hosting provider which form-to-email scripts you can use with your server.   If your server doesn't support it, you can't use it.  Simple as that.

 

Most reliable hosting providers recommend PHPMailer  -- a safe & secure mail sending library that prevents spammers from exploiting forms and using your server as a spam relay.   These days, web security is a major concern.  It's essential that you use secure scripts & forms to protect yourself and your site visitors.

 

PHPMailer (scroll down to Simple Example)

https://github.com/PHPMailer/PHPMailer

 

Hope that helps.

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 08, 2022 Oct 08, 2022

@Nancy OShea have a look at https://community.adobe.com/t5/dreamweaver-discussions/re-submiting-a-webform-via-the-submit-button-...

 

It falls on deaf ears.

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 09, 2022 Oct 09, 2022
quote

@Nancy OShea have a look at https://community.adobe.com/t5/dreamweaver-discussions/re-submiting-a-webform-via-the-submit-button-...

 

It falls on deaf ears.


By @BenPleysier

 

Thanks for sharing that.  If that really is the site, the only issue is that the script action mailform.php results in a 404 error. So the issue isn't with the script functioning, but rather the fact that it doesn't exist.  Personally I would recommend a Wufoo in this instance because of the types of issues that are being run into from this thread and the one you reference.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 09, 2022 Oct 09, 2022

Either Wufoo.com or JotForms.com

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 12, 2022 Oct 12, 2022
quote

Hi Guys,

I want a send script that will submit a form from a website.

The code should be in Java or JavaScript or any other programming language.

The form on this website previously had a PHP send script that works, but the creators have now modified the code. Thanks, any ideas or suggestions will help.


By @smartCode

Hi, SmartCode,

if i am not wrong then your hosting provide may have disable the sendmail() function. Though if you can search through internet , you may find lots ot php form template.  Here , I can share small jquery form other than php one. I recommend you php if you are good with php only.

You may try this PHP and Jquery Based Form:-

STEP : 1

<html>
<head>
<title>Simple jQuery Contact Form With Validation</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<link rel="stylesheet" href="css/contact_form.css" />
<script src="contact_form.js"></script>
</head>
<body>
<div id="mainform">
<h2>Simple jQuery Contact Form With Validation</h2>
<!-- Required Div Starts Here -->
<form id="form">
<h3>Contact Form</h3>
<p id="returnmessage"></p>
<label>Name: <span>*</span></label>
<input type="text" id="name" placeholder="Name"/>
<label>Email: <span>*</span></label>
<input type="text" id="email" placeholder="Email"/>
<label>Contact No: <span>*</span></label>
<input type="text" id="contact" placeholder="10 digit Mobile no."/>
<label>Message:</label>
<textarea id="message" placeholder="Message......."></textarea>
<input type="button" id="submit" value="Send Message"/>
</form>
</div>
</body>
</html>

 STEP : 2 Given below our complete jQuery code.  jQuery File: contact_form.js

$(document).ready(function() {
$("#submit").click(function() {
var name = $("#name").val();
var email = $("#email").val();
var message = $("#message").val();
var contact = $("#contact").val();
$("#returnmessage").empty(); // To empty previous error/success message.
// Checking for blank fields.
if (name == '' || email == '' || contact == '') {
alert("Please Fill Required Fields");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("contact_form.php", {
name1: name,
email1: email,
message1: message,
contact1: contact
}, function(data) {
$("#returnmessage").append(data); // Append returned message to message paragraph.
if (data == "Your Query has been received, We will contact you soon.") {
$("#form")[0].reset(); // To reset form fields on success.
}
});
}
});
});

STEP : 3 PHP Script: contact_form.php

<?php
// Fetching Values from URL.
$name = $_POST['name1'];
$email = $_POST['email1'];
$message = $_POST['message1'];
$contact = $_POST['contact1'];
$email = filter_var($email, FILTER_SANITIZE_EMAIL); // Sanitizing E-mail.
// After sanitization Validation is performed
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
if (!preg_match("/^[0-9]{10}$/", $contact)) {
echo "<span>* Please Fill Valid Contact No. *</span>";
} else {
$subject = $name;
// To send HTML mail, the Content-type header must be set.
$headers = 'MIME-Version: 1.0' . "rn";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
$headers .= 'From:' . $email. "rn"; // Sender's Email
$headers .= 'Cc:' . $email. "rn"; // Carbon copy to Sender
$template = '<div style="padding:50px; color:white;">Hello ' . $name . ',<br/>'
. '<br/>Thank you...! For Contacting Us.<br/><br/>'
. 'Name:' . $name . '<br/>'
. 'Email:' . $email . '<br/>'
. 'Contact No:' . $contact . '<br/>'
. 'Message:' . $message . '<br/><br/>'
. 'This is a Contact Confirmation mail.'
. '<br/>'
. 'We Will contact You as soon as possible .</div>';
$sendmessage = "<div style="background-color:#7E7E7E; color:white;">" . $template . "</div>";
// Message lines should not exceed 70 characters (PHP rule), so wrap it.
$sendmessage = wordwrap($sendmessage, 70);
// Send mail by PHP Mail Function.
mail("receiver_email_id@abc.com", $subject, $sendmessage, $headers);
echo "Your Query has been received, We will contact you soon.";
}
} else {
echo "<span>* invalid email *</span>";
}
?>

STEP : 4 CSS File: contact_form.css

@Import url(http://fonts.googleapis.com/css?family=Fauna+One|Muli);
#mainform{
width:960px;
margin:20px auto;
padding-top:20px;
font-family: 'Fauna One', serif;
}
#form{
border-radius:2px;
padding:20px 30px;
box-shadow:0 0 15px;
font-size:14px;
font-weight:bold;
width:350px;
margin:20px 250px 0 35px;
float:left;

}
h3{
text-align:center;
font-size:20px;
}
input{
width:100%;
height:35px;
margin-top:5px;
border:1px solid #999;
border-radius:3px;
padding:5px;
}
input[type=button]{
background-color:#123456;
border:1px solid white;
font-family: 'Fauna One', serif;
font-Weight:bold;
font-size:18px;
color:white;
}
textarea{
width:100%;
height:80px;
margin-top:5px;
border-radius:3px;
padding:5px;
resize:none;
}
span{
color:red
}
#note{
color:black;
font-Weight:400;
}
#returnmessage{
font-size:14px;
color:green;
text-align:center;
}

I hope this will be helpful.

Thanks

usps tracking

--
Dav
https://usps-track.us
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 12, 2022 Oct 12, 2022

@DavidM72,

The PHP script you're using isn't as safe & secure as it should be. 

1. It contains no server-side form validation in case client-side scripts are disabled.  There is nothing in place to stop spambots from exploiting the form.  

2. The mail sending script won't work without PHP mail ( ) enabled on the server.  Some hosts have disabled PHP mail for security reasons.

 

Use PHPMailer.  It's a safer and more secure alternative.

PHPMailer (scroll down to Simple Example)

https://github.com/PHPMailer/PHPMailer

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 03, 2022 Nov 03, 2022

How do you check if the code is not secure? I'm a beginner.

 

[URL removed by moderator.]

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 03, 2022 Nov 03, 2022

Ensuring the security of a PHP code lies on multiple tracks of observations. Moreover it can be related to various environment parameters, such as the management of IN and OUT files, the server itself, the way PHP is activated or installed, the interactions with one or more databases, the way this PHP file will be solicited (browser call, internal call direct from the same server, or from a remote server (cross scripting), so AJAX call... etc.)... etc....


In short, there is no single path to explore or verify.


There are online tools that allow us to check some code consistency, or obsolete usage, or risk of flaw... like :

but this is only an indication, and eradicates the big mistakes...

There are also tools to install, and to use internally, that can help you to refine your code https://geekflare.com/php-security-scanner/

 

Anyway, as a beginner, get into good habits... starting by reading the manual about it, can be a good thing to do https://www.php.net/manual/en/security.php

 

Once you get the hang of the basics of the language and the interactions it causes, there are various types of articles that are uninteresting, and vertical, on the subject like :

 

But it requires to have already had a minimum of practice with the language, and to have a minimum of practice to better highlight the solutions or approaches that are addressed.

 

@moderators : It might be appropriate to move this post to a new thread, as it is not too related to the original question... what do you think?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 03, 2022 Nov 03, 2022
LATEST

@Ricky25288538yunf,

Security begins at the server level.  Your hosting provider must perform  regular maintenance and security updates.  Make sure your hosting plan includes SSL/TLS certificates.  HTTPS is more secure than HTTP protocol.  Many hosting plans include HTTPS in their basic package. Others charge an additional fee. 

 

As @L e n a said, security is a big & complex issue.  Beginners should leave script writing to experienced professionals.  Don't trust amateurs who don't know what they don't know.  Use 3rd party contact form services like Wufoo.com, JotForms.com or MailChimp.com.  

 

Refer to Web Security Documents on MDN:

https://developer.mozilla.org/docs/Web/Security

 

Keep your computer clean.  Use up-to-date anti-virus and anti-spyware software.  Scan your computer regularly.  If your computer is dirty, chances are your server soon will be too. 😉

 

Use common sense. Don't use untrusted widgets or free scripts you find online.  More often than not, they aren't worth the paper they're printed on and could put you, your site and your site visitors at risk for malware.

 

Hope that helps.

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines