Witajcie,
stworzylem formularz kontaktowy (dziala poprawnie) problem w tym, ze chce go umiescic na serwerze z wylaczona funkcja PHP mail() , niestety zmiana serwera nie wchodzi w gre.
- Formularz podzielony jest na 2 pliki jeden odpowiedzialny za stworzenie pol a 2 za odczyt i wyslanie maila.
Chcialbym wyedytowac kod i tu bardzo prosze Was o pomoc, tak aby skrypt odpowiedzialny za odczyt i wysylanie maili mogl sie wykonywac na zewnetrznym serwerze.
Podejrzewam ze trzebaby zmienic fragment kodu pierwszego (linijki 4 i 5) i sama metode $_POST kodu drugiego, probowalem rozne metody ale niestety za nic nie chcialo ruszyc.
Bede ogromnie wdzieczny jak ktos bedzie w stanie pomoc i zrozumie pewnie dosc chaotycznie napisana prosbe (IMG:
style_emoticons/default/smile.gif)
Fragment kodu pliku kontakt.php
<?php
if ($_POST['submit']) {
}
else
{
?>
<form name="contactform" method="post" action="kontakt.php" onSubmit="return validate.check(this)">
<table width="350px" class="contactform">
<tr>
<td colspan="2">
<div class="contactformmessage">Pola oznaczone <span class="required_star"> * </span> musza byc wypelnione.</div>
</td>
</tr>
<tr>
<td valign="top">
<label for="Full_Name" class="required">Imie i Nazwisko<span class="required_star"> * </span></label>
</td>
<td valign="top">
<input type="text" name="Full_Name" id="Full_Name" maxlength="80" style="width:200px">
</td>
</tr>
<tr>
<td valign="top">
<label for="Email_Address" class="required">Email<span class="required_star"> * </span></label>
</td>
<td valign="top">
<input type="text" name="Email_Address" id="Email_Address" maxlength="100" style="width:200px">
</td>
</tr>
<tr>
<td valign="top">
<label for="Telephone_Number" class="not-required">Telefon</label>
</td>
<td valign="top">
<input type="text" name="Telephone_Number" id="Telephone_Number" maxlength="100" style="width:200px">
</td>
</tr>
<tr>
<td valign="top">
<label for="Your_Message" class="required">Wiadomosc<span class="required_star"> * </span></label>
</td>
<td valign="top">
<textarea style="width:200px;height:160px" name="Your_Message" id="Your_Message" maxlength="2000"></textarea>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center" >
<br /><br />
<input type="submit" id="submit" name="submit" value=" Wyślij ">
<br /><br />
</td>
</tr>
</table>
</form>
<?php
};
?>
a to kod pliku contactformprocess.php ktory chcialbym umiescic na zewnetrznym serwerze
<?PHP
if(isset($_POST['Email_Address'])) {
$email_to = "adres@email"; // your email address
$email_subject = "Formularz Kontaktowy"; // email subject line
function died($error) {
echo 'Błąd wysyłania. Sprobuj ponownie.'; }
if(!isset($_POST['Full_Name']) || !isset($_POST['Email_Address']) || !isset($_POST['Telephone_Number']) || !isset($_POST['Your_Message']) ) {
died();
}
$full_name = $_POST['Full_Name']; // required
$email_from = $_POST['Email_Address']; // required
$telephone = $_POST['Telephone_Number']; // not required
$comments = $_POST['Your_Message']; // required
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
$error_message .= 'Adres Email wygląda na niepoprawny.<br />';
}
$error_message .= 'Imię nie wygląda na poprawne.<br />';
}
$error_message .= 'Wiadomość nie wygląda na poprawną.<br />';
}
if(strlen($error_message) > 0
) { died($error_message);
}
$email_message = "Formularz Kontaktowy\r\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:"); }
$email_message .= "Imie i Nazwisko: ".clean_string($full_name)."\r\n";
$email_message .= "Email: ".clean_string($email_from)."\r\n";
$email_message .= "Telefon: ".clean_string($telephone)."\r\n";
$email_message .= "Wiadomosc: ".clean_string($comments)."\r\n";
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
@mail($email_to, $email_subject, $email_message, $headers);
echo 'Formularz wysłany pomyślnie. Dziękujemy'; }
?>