mail() function

Alles, was PHP betrifft, kann hier besprochen werden.

mail() function

Postby wakeup » 20. June 2008 11:55

Hello

Code: Select all
<?php
                  if (empty($_POST['knownsender'])) {
                     $_POST['knownsender'] = '';
                  }
                  if (empty($_POST['recipients'])) {
                     $_POST['recipients'] = '';
                  }
                  if (empty($_POST['ccaddress'])) {
                     $_POST['ccaddress'] = '';
                  }
                  if (empty($_POST['subject'])) {
                     $_POST['subject'] = '';
                  }
                  if (empty($_POST['message'])) {
                     $_POST['message'] = '';
                  }
                  $mailtos = $_POST['recipients'];
                  $subject = $_POST['subject'];
                  $message = $_POST['message'];

                  if (($_POST['ccaddress'] == "") || ($_POST['ccaddress'] == " ")) {
                     $header = "From: $_POST[knownsender]";
                  } else {
                     $header .= "From: $_POST[knownsender]\r\n";
                     $header .= " Cc: $_POST[ccaddress]";
                  }

                  if (@mail($mailtos, $subject, $message, $header)) {
                     echo "<i>".$TEXT['mail-sendok']."</i>";
                  } else {
                     echo "<i>".$TEXT['mail-sendnotok']."</i>";
                  }
               ?>


This code is placed in mailsend.php of xampp directory.

This works perfect, but I prepared a mail page and added:

Code: Select all
mail("mymail@domain.com","Subj","a message")


Although this seems to be true, Mercury mail didnt show any message to make sure my mail was sent. How can I simplfy the mail function?
wakeup
 
Posts: 3
Joined: 13. June 2008 19:14

Postby Nobbie » 21. June 2008 13:02

>How can I simplfy the mail function?

Why "simplifiy"? Or do you mean something completely different (i.e. how to configure your PHP in order to send mails?).

You have to configure php.ini in order to make mail() function working correctly.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04


Return to PHP

Who is online

Users browsing this forum: No registered users and 13 guests