How can I use the sendmail in web page to recive users’s suggestions ?
You could use a simple contact form yes?
https://www.freecontactform.com/email_form.php
I use https://www.foxyform.com/ or https://www.google.co.uk/forms/about/
Thank you!!!
I used this form and php script.
I haven’t error messages, but the email dosn’t arrive
The core script is:
@mail($email_to, $email_subject, $email_message, $headers);
I don’t know if the server process this or I have to config something.
My domain is “rosario4celular.com.ar”
When I send a message by email to “contact@rosario4celular.com.ar” with another count it arrived well.
<?PHP
$sender = 'xxxxxxxx@gmail.com';
$recipient = 'xxxxxx@gmail.com';
$subject = "php mail test";
$message = "php test message";
$headers = 'From:' . $sender;
if (mail($recipient, $subject, $message, $headers))
{
echo "Message accepted";
}
else
{
echo "Error: Message not accepted";
}
?>
This is working on your website currently.
Try out PHP Mailer?
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require $_SERVER['DOCUMENT_ROOT'] . '/mail/Exception.php';
require $_SERVER['DOCUMENT_ROOT'] . '/mail/PHPMailer.php';
require $_SERVER['DOCUMENT_ROOT'] . '/mail/SMTP.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2; // 0 = off (for production use) - 1 = client messages - 2 = client and server messages
$mail->Host = gethostbyname('smtp.gmail.com'); // use $mail->Host = gethostbyname('smtp.gmail.com'); // if your network does not support SMTP over IPv6
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->Port = 587; // TLS only
$mail->SMTPSecure = 'tls'; // ssl is deprecated
$mail->SMTPAuth = true;
$mail->Username = '################@gmail.com'; // email
$mail->Password = '################'; // password
$mail->setFrom('################@gmail.com', 'NAME HERE PLEASE ########'); // From email and name
$mail->addAddress('################', 'NAME HERE PLEASE ################'); // to email and name
$mail->Subject = 'PHPMailer GMail SMTP test';
$mail->msgHTML("test body"); //$mail->msgHTML(file_get_contents('contents.html'), __DIR__); //Read an HTML message body from an external file, convert referenced images to embedded,
$mail->AltBody = 'HTML messaging not supported'; // If html emails is not supported by the receiver, show this body
// $mail->addAttachment('images/phpmailer_mini.png'); //Attach an image file
if(!$mail->send()){
echo "Mailer Error: " . $mail->ErrorInfo;
}else{
echo "Message sent!";
}
?>
This topic was automatically closed after 13 days. New replies are no longer allowed.