Skip to content Skip to sidebar Skip to footer

Html And Php Mail Application Not Sending

I trying to make an application form but it just won't work. I've been searching on the site to find some answers, but without luck. - I have tried several different scripts. And t

Solution 1:

You're not calling mail correctly:

mail($myemail, $name, $birthday, $cloths, $currentclub, $clubranking, $coachphone, $clubhis, $team, $attention, $message);

The manpage is here: http://php.net/manual/en/function.mail.php - you need to pass in the email address; the subject line; and the message; with a couple of optional parameters. You need to concatenate all your text into a single message variable, and pass that variable in, instead of each of the different values:

mail ($myemail, 'Subject', $message);

Solution 2:

The basic mail() function takes 3 parameters like so

mail(to, subject, message)

You can add headers and additional parameters too.

change your mail() line to

mail($myemail, $email, $message);

Solution 3:

You read the documentation of mail function, http://php.net/manual/en/function.mail.php

mail($myemail, $name, $birthday, $cloths, $currentclub, $clubranking, $coachphone, $clubhis, $team, $attention, $message);

the arguments you are passing in the mail() function are wrong...

you try writing mail($myemail, $email, $message)

Variable $myemail should store the email of the recipient and $email should have the subject stored in it, and $message should contain the message you want to send.

Solution 4:

I believe the error looks to be with the use of your mail() php function, this function only takes a maximum of 5 parameters

mail($myemail, $name, $birthday, $cloths, $currentclub, $clubranking, $coachphone, $clubhis, $team, $attention, $message);

You appear to have included $name, $birthday, $cloths, $currentclub, $clubranking, $coachphone, $clubhis, $team, $attention, $message already inside your $message variable so no need to include these again in the mail function.

Your code should look something similar to:

$emailMessage = "
name: $name
E-mail: $email
Birthday: $birthday
Cloths: $cloths
Currentclub: $currentclub
Clubranking: $clubranking
Coachphone $coachphone
Clubhis: $clubhis
Team: $team
Attention: $attention
Message: $message
";

 mail($myemail, $subject, $emailMessage);

Refer to http://php.net/manual/en/function.mail.php for the usage of the mail() function.

Solution 5:

Please see the example code for mail .. https://stackoverflow.com/questions/20072751/write-the-email-code-for-upload-resume-in-contact-page-receive-the-email-in-php/20073275#20073275

Send a simple email:

<?php$txt = "First line of text\nSecond line of text";

// Use wordwrap() if lines are longer than 70 characters$txt = wordwrap($txt,70);

// Send email
mail("somebody@example.com","My subject",$txt);
?>

Send an email with extra headers:

<?php$to = "somebody@example.com";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: webmaster@example.com" . "\r\n" .
"CC: somebodyelse@example.com";

mail($to,$subject,$txt,$headers);
?>

Send an HTML email:

<?php$to = "somebody@example.com, somebodyelse@example.com";
$subject = "HTML email";

$message = "
<html>
<head>
<title>HTML email</title>
</head>
<body>
<p>This email contains HTML Tags!</p>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
</tr>
</table>
</body>
</html>
";

// Always set content-type when sending HTML email$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";

// More headers$headers .= 'From: <webmaster@example.com>' . "\r\n";
$headers .= 'Cc: myboss@example.com' . "\r\n";

mail($to,$subject,$message,$headers);
?>

Post a Comment for "Html And Php Mail Application Not Sending"