Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> mail handler, wysylanie maila ze strony www, jak to zrobic?
dts512
post 6.11.2014, 15:02:37
Post #1





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 7.02.2011

Ostrzeżenie: (0%)
-----


Witam

nie mam pojęcia o php

jest strona html css w zakładce kontakt mam pole do wysłania wiadomości

w folderze strony jest folder bin a w nim plik php mail handler

jak mam to skonfigurować żeby na moja poczte przychodzily wiadomości wysylane poprzez formularz ze strony www

cos mam w tym wypelnic?

podaje zawartość pliku mail handler:

<?php
$owner_email = $_POST["owner_email"];
$headers = 'From:' . $_POST["email"];
$subject = 'A message from your site visitor ' . $_POST["name"];
$messageBody = "";

$messageBody .= '<p>Visitor: ' . $_POST["name"] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
$messageBody .= '<p>Email Address: ' . $_POST['email'] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
if($_POST['state']!='nope'){
$messageBody .= '<p>State: ' . $_POST['state'] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}
if($_POST['phone']!='nope'){
$messageBody .= '<p>Phone Number: ' . $_POST['phone'] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}
if($_POST['fax']!='nope'){
$messageBody .= '<p>Fax Number: ' . $_POST['fax'] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}
$messageBody .= '<p>Message: ' . $_POST['message'] . '</p>' . "\n";

if($_POST["stripHTML"] == 'true'){
$messageBody = strip_tags($messageBody);
}

try{
if(!mail($owner_email, $subject, $messageBody, $headers)){
throw new Exception('mail failed');
}else{
echo 'mail sent';
}
}catch(Exception $e){
echo $e->getMessage() ."\n";
}
?>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
grzes999
post 6.11.2014, 16:53:57
Post #2





Grupa: Zarejestrowani
Postów: 305
Pomógł: 29
Dołączył: 5.07.2011

Ostrzeżenie: (0%)
-----


Jeśli mają przychodzić tylko na twój adres to zmień ta linie:
  1. $owner_email = 'adres@mail.com';

Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 13.08.2025 - 23:27