Witam serdecznie, od razu na wstępie chciałbym zaznaczyć, że nie zajmuje się php, jednak osoba która była za to odpowiedzialna, nie odpisuje, dlatego zgłaszam się do was z prośbą o wyjaśnienie, bądź przerobienie kodu tak aby wysyłanie formularza działało. Próbowałem na kilku hostingach, na żadnym z nich wiadomości nie wysyłają się. Próbowałem również na SMTP od google z prywatnego emaila, nadal nic. Ktoś ma pomysł? Będę na prawdę wdzięczny!
<?php
if(isset($_POST['submit'])) {
$message=
'Full Name: '.$_POST['fullname'].'<br />
Subject: '.$_POST['subject'].'<br />
Phone: '.$_POST['phone'].'<br />
Site see: '.$_POST['site'].'<br />
Contact form: '.$_POST['contact'].'<br />
Email: '.$_POST['emailid'].'<br />
Comments: '.$_POST['comments'].'
';
require "phpmailer/class.phpmailer.php"; //include phpmailer class
// Instantiate Class
$mail = new PHPMailer();
// Set up SMTP
$mail->IsSMTP(); // Sets up a SMTP connection
$mail->Host = "mx1.hostinger.pl"; //Gmail SMTP server address
$mail->SMTPDebug = false;
$mail->SMTPAuth = true; // Connection with the SMTP does require authorization
$mail->SMTPSecure = "ssl"; // Connect using a TLS connection
$mail->Port = 2525; //Gmail SMTP port
$mail->Encoding = '7bit';
// Authentication
$mail->Username = "phpsender@asvaphp.esy.es"; // Your full Gmail address
$mail->Password = "test123"; // Your Gmail password
// Compose
$mail->SetFrom($_POST['emailid'], $_POST['fullname']);
$mail->AddReplyTo($_POST['emailid'], $_POST['fullname']);
$mail->Subject = "New Contact" ; // Subject (which isn't required)
if (isset($_FILES['uploaded_file']) && $_FILES['uploaded_file']['error'] == UPLOAD_ERR_OK) {
$mail->AddAttachment($_FILES['uploaded_file']['tmp_name'],
$_FILES['uploaded_file']['name']);
}
$mail->MsgHTML($message);
// Send To
$mail->AddAddress("phpreceiver@asvaphp.esy.es"); // Where to send it - Recipient
$result = $mail->Send(); // Send!
$message = $result ? 'Successfully Sent!' : 'Sending Failed!';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Dokument bez tytułu</title>
</head>
<link rel="stylesheet" type="text/css" href="contactformtheme.css">
<link rel=""
<body>
<form action="" method="post" enctype="multipart/form-data" id="contact-frm">
<fieldset>
<legend>Contact Form</legend>
<ul>
<li>
<label for="name">Full Name <strong class="asterisk">*</strong></label>
<input type="text" name="fullname" id="name" placeholder="Name and surname" />
</li>
<li>
<label for="email">E-mail <strong class="asterisk">*</strong></label>
<input type="email" name="emailid" id="email" placeholder="Your e-mail address" />
</li>
<li>
<label for="phone">Phone Number</label>
<input type="tel" name="phone" id="phone" placeholder="Your phone number" />
</li>
<li>
<label for="subject">Label <strong class="asterisk">*</strong></label>
<select id="subject" name="subject">
<option value="1">Purchase Support: Payment Methods, Upgrades, and Products</option>
<option value="2">Job Find Support: Free CV Upload, Free phone consultaiton, and Issues </option>
<option value="3">Others</option>
</select>
</li>
<li>
<label for="message">Text <strong class="asterisk">*</strong></label>
<textarea name="message" id="comments" rows="10" cols="50" placeholder="Enter your commant here">
</textarea>
<li class="options-set-inline">Preferred contact form:
<ul>
<li class="choose">
<label><input type="radio" name="contact" value="Email" /> E-mail</label>
</li>
<li class="choose">
<label><input type="radio" name="contact" value="Phone" /> Phone</label>
</li>
</ul>
</li>
<li class="options-set-inline">used our service before?
<ul>
<li class="choose">
<label><input type="radio" name="site" value="y" /> Yes</label>
</li>
<li class="choose">
<label><input type="radio" name="site" value="n" /> No</label>
</li>
</ul>
</li>
<li class="options-set-inline">Attachments<br />
<input type="file" name="uploaded_file">
</li>
</ul>
</fieldset>
<p class="frm-actions wrapper">
<input type="submit" name="submit" value="Send to the consultant" />
</p>
</form>
</body>
</html>
A więc jest jakiś geniusz, który by mnie naprowadził? Błagam, męczę się z tym od rana:).
Powód edycji: [Kshyhoo]: bb-code