Jump to content

sending mail


newbienewbie

Recommended Posts

<html>
<head>
<title>Form Reader</title>
</head>
<body>

<?php
$to      = '[email protected]';
$subjectmail() = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>
</body>
</html>

 

Tell this newbie , why above program doesn't sends mail?

 

 

Link to comment
https://forums.phpfreaks.com/topic/40332-sending-mail/
Share on other sites

<?php
$to      = '[email protected]';
$subjectmail() = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

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

 

try removing the HTML

 

monk.e.boy

Link to comment
https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-195146
Share on other sites

<?php
$to      = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

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

 

maybe that?

 

monk.e.boy

Link to comment
https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-195164
Share on other sites

Argh! As far as we can tell your code is ok, you need to look at where else the error may be. Have you tried the port 25 thing yet?

 

If it is not open, then the mail WILL NOT be sent. My host does not open port 25, I'd guess so they don't get spammers abusing their system.

 

monk.e.boy

Link to comment
https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-195908
Share on other sites

on my live server, just 2line code is working fine

 

<?php
mail('[email protected]', 'Test Subject', 'Test Message');
echo "Mail Sent";
?>

 

but it is not working on local server. what sshld i do troubleshoot local server. other php code on local server is wrking fine.

Link to comment
https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-200665
Share on other sites

getting following errro in apache

 

SMTP server response: 550 5.7.1 Unable to relay for [email protected] in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\testing\\mail.php on line 11

 

[mail function]
; For Win32 only.
;SMTP = localhost
SMTP=localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = [email protected]
sendmail_from = [email protected]

tried with smtp.myrealdomain.com also 

Link to comment
https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-200691
Share on other sites

i have the same problem....

this is my code:

 

$to = $_POST['Email'];

$subject = "Welcome";

$body = "<p>Bem Vindo</p>

<p>Vimos por este mail informar que a sua activação da conta está completa.</p>";

$headers = 'From: [email protected]' . "\r\n" .

    'Reply-To: [email protected]' . "\r\n" .

    'X-Mailer: PHP/' . phpversion();

.....

if (mail($to, $subject, $body, $headers)) {

  echo("<p>Email enviado!</p>");

 

 

 

 

 

in my php.ini i change to this way:

 

[mail function]

; For Win32 only.

SMTP = smtp.myrealdomain.com

smtp_port = 25

 

; For Win32 only.

sendmail_from = [email protected]

 

 

plz help me

Link to comment
https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-200848
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.