0; } if ($_POST['submit'] == "yes") { $subject = $_POST['subject']; $from = $_POST['from']; } else { $subject = $_GET['subject']; $from = ""; } $html_search = array('', '', '', '', '', '', '', '', "", '', '\"', '<', '>' ); $html_replace = array('ü', 'å', 'ä', 'ö', 'Ü', 'Å', 'Ä', 'Ö', "'", '&eur;', '"', '<', '>'); $mime_search = array('=', '', '', '', '', '', '', '', '', "", '', '\"', "\nFrom "); $mime_replace = array('=3D', '=FC', '=E5', '=E4', '=F6', '=DC', '=C5', '=C4', '=D6', "'", '=80', '"', "\n From "); $message = $_POST['message']; $message_html = str_replace($html_search, $html_replace, $message); $message_mime = str_replace($mime_search, $mime_replace, $message); $subject_html = str_replace($html_search, $html_replace, $subject); $subject_mime = str_replace($mime_search, $mime_replace, $subject); if ($subject_mime != $subject) { $subject_mime = "=?iso-8859-1?Q?" . $subject_mime; } if ($_POST['submit'] != "yes" || !email_address_ok($from) || $message == "") { printf("%s\n", '

Contact me

'); printf("%s\n", '
'); printf("%s\n", '
'); printf("%s\n", ''); printf("%s\n", ''); printf("\n", $from); printf("\n", $subject_html); printf("\n", $message_html); printf("%s\n", ''); if ($_POST['submit'] == "yes") { if (!email_address_ok($from)) { printf("\n"); } else if ($message == "") { printf("\n"); } } printf("%s\n", '
To:
From:
Subject:
Message:   

      

Please enter a valid e-mail address in the \"From\" field!

Please write something in the \"Message\" field!
'); printf("%s\n", ''); printf("%s\n", '
'); printf("%s\n", '
'); } else { $header = "From: " . $from . "\n"; $header .= "MIME-Version: 1.0\n"; $header .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n"; $header .= "Content-Transfer-Encoding: quoted-printable"; #printf("
\nFrom -\n%s\nSubject: %s\n\n%s\n
\n", $header, $subject_mime, $message_mime); $ok = @mail("c@sundin.nu", $subject_mime, $message_mime, $header); if ($ok) { printf("

Message sent.\n"); } else { printf("

An error occurred while sending the message! =(\n"); } printf("

«  Home  »\n"); } ?>