DeveloperSide.NET Forums
May 22, 2018, 02:14:01 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1] 2 3
  Print  
Author Topic: mail function not working at. all header problem?  (Read 41332 times)
0 Members and 1 Guest are viewing this topic.
sbuggle
Jr. Member
**
Posts: 42


View Profile
« on: November 04, 2004, 07:42:08 PM »

Having problem with mail fucntion, did this little test and it is giving me the error below in the log directory.

Here is the code:

<?
$recipient = "s.buggle@att.net";
$subject = "Test E-mail Message";
$message = "This is the e-mail message.";
$senderemail = "From:r.buggle@att.net";
mail($recipient , $subject,$message);

 ?>
I have tried it various ways with the  from:etc) or without.
I read another email about the same subject and said to go to the php file and change the code here is that below

SMTP = postoffice.worldnet.att.net
smtp_port = 25

; For Win32 only.
;sendmail_from = s.buggle@.att.net


Help!



[client 127.0.0.1] PHP Warning:  mail(): &quot;sendmail_from&quot; not set in php.ini or custom &quot;From:&quot; header missing in C:\\www\\webroot\\mailtest.php on line 6
Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #1 on: November 05, 2004, 12:10:05 AM »

Uncomment...
Quote

;sendmail_from = s.buggle@.att.net


Fix that address, as it's syntax is wrong.

Restart Apache or Reboot.  Anything else, and it's a problem with your code.

If you read the error message, it is stating that "sendmail_from" is missing (you have it commented out under php.ini) and that since it is missing, you also have not defined a "from" message header.
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
sbuggle
Jr. Member
**
Posts: 42


View Profile
« Reply #2 on: November 05, 2004, 01:52:12 AM »

I took the ; out before the sendmail_from = s.buggle@.att.net
and changed it to sendmail_from = s.buggle@worldnet.att.net

This is the whole page of mailtest.php
<?
$recipient = "s.buggle@worldnet.att.net";
$subject = "Test E-mail Message";
$message = "This is the e-mail message.";
$senderemail = "r.buggle@att.net";
mail($recipient,$subject,$message,$senderemail) or die ("Failure");

 ?>
In the error file it has
 [client 127.0.0.1] PHP Warning:  mail(): Failed to connect to mailserver at &quot;postoffice.worldnet.att.net&quot; port 25, verify your &quot;SMTP&quot; and &quot;smtp_port&quot; setting in php.ini or use ini_set() in C:\\www\\webroot\\mailtest.php on line 6


Do you have any suggestions?
Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #3 on: November 05, 2004, 02:18:35 AM »

If your ISP's SMTP/POP address is correct, then it also might require a username with password.

I think it might be possible to specify that mail server address as...
user:password@your.SMTP/POP.server
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #4 on: November 05, 2004, 02:27:17 AM »

Also, are you typing the incoming (to receive mail) or outgoing (to send mail) mail server address?

I ran "postoffice.worldnet.att.net " in google, and found "mailhost.worldnet.att.net" for the outgoing mail server.

Quote

Incoming Mail (POP3 - port 110): postoffice.worldnet.att.net
Outgoing Mail (SMTP - port 25): mailhost.worldnet.att.net
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
sbuggle
Jr. Member
**
Posts: 42


View Profile
« Reply #5 on: November 05, 2004, 03:14:19 AM »

That did it  :)

Thank you so........ooo much

The username and passworld along with changing the outgoing to  mailhost.worldnet.att.net did it!



Thanks again
Sharon
Logged
comrade693
Member
*
Posts: 13


View Profile
« Reply #6 on: December 30, 2004, 07:38:50 PM »

I'm having the same problem, and I've tried the solutions that I've seen in this forum.  I'm not sure what to do.

I am running WinXP Pro with SP2.  Windows firewall is disabled.  Apache version 2.0.52 with PHP 4.3.10.

PHP.ini
Code:

[mail function]
; For Win32 only.
SMTP = smtp.itd.umich.edu
smtp_port = 25

; For Win32 only.
sendmail_from = sdwilsh@umich.edu



PHP Code
Code:

<?php

$to 
"sdwilsh@umich.edu";
$subject "TEST";
$headers  "MIME-Version&#58; 1.0\r\n";
$headers .= "Content-type&#58; text/html; charset=iso-8859-1\r\n";
$headers .= "From&#58; Keep In Touch Admin <sdwilsh@umich.edu>\r\n";

$message =  '
<html>
<head>
 <title>Birthday Reminders for August</title>
</head>
<body>
<p>Test e-mail!</p>
</body>
</html>'
;

mail&#40;$to, $subject, $message, $headers&#41;;

?>


Error Message
Quote

[30-Dec-2004 14:19:20] PHP Warning:  mail(): Failed to connect to mailserver at "smtp.itd.umich.edu" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\Apache Group\Apache2\htdocs\test.php on line 19


Here is the link for information regarding my smtp server:
http://www.itd.umich.edu/itcsdocs/s4321/outlook.html#imap

My test script was taken from PHP.net.  I just removed parts of the e-mail message.  I am just trying to send an e-mail to myself first so that I can make sure it is working.  Any help would be greatly appreciated.
Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #7 on: December 30, 2004, 08:13:20 PM »

Did you save file C:\Windows\php.ini after making changes?
Did you restart Apache or reboot system?
Does your ISP require a username/password for your mail server?
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
comrade693
Member
*
Posts: 13


View Profile
« Reply #8 on: December 30, 2004, 09:17:24 PM »

yes, yes, and no

I should make a note that my php.ini file is located in the php root folder.  In the newest version, it checks there first, so I left it there.
Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #9 on: December 30, 2004, 10:13:07 PM »

Make a copy and put in into C:\Windows\

Restart Apache or reboot.

1) You might have an older version there, which your PHP is reading -- and the reason it is working.
2) php.ini needs to be under C:\Windows or C:\WINNT -- unless you have configured it to be somewere else and the system can find it.  The only reason it would be under your PHP root dir, is if you were not using the Apache module of PHP, but the CLI (command line interface) version.

Quote

Copy your chosen ini-file to a directory that PHP is able to find and rename it to php.ini. PHP searches for php.ini in the following locations (in order):

     * PHPIniDir directive (Apache 2 module only)
     * HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath
     * The PHPRC environment variable
     * Directory of PHP (for CLI), or the web server's directory (for SAPI modules)
     * Windows directory (C:\windows or C:\winnt)


And you should take a look around http://www.devside.net/
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
comrade693
Member
*
Posts: 13


View Profile
« Reply #10 on: December 30, 2004, 11:01:03 PM »

When I installed, php.net said this:
Quote

Example 6-6. PHP and Apache 2.0 as Module

Code:
# For PHP 4 do something like this:
LoadModule php4_module "c:/php/sapi/php4apache2.dll"
AddType application/x-httpd-php .php

# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir "C:/php"


In apache configureation file i have this
Code:

LoadModule php4_module "C:/Program Files/php/sapi/php4apache2.dll"
AddType application/x-httpd-php .php
AddHandler php-script php
AddType text/html php
PHPIniDir "C:/Program Files/php"


When i moved my.ini to c:/windows it did not work at all.

I know I do not have an older version of php that it is reading because i just did a reformat on my hard drive, consequently having to install everything again.  I have no idea why it is not working still, and this just seemed like the most useful place to ask.
Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #11 on: December 30, 2004, 11:12:27 PM »

Quote

AddHandler php-script php
AddType text/html php


Why this ?

Quote

When i moved my.ini (php.ini ?) to c:/windows it did not work at all.


You would need to remove 'PHPIniDir "C:/Program Files/php"' for that to work.
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #12 on: December 30, 2004, 11:16:41 PM »

Either way, you might want to try the simplest of mail messages, without the headers, and the rest.  Sometimes the error messages are not exactly on point.
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #13 on: December 30, 2004, 11:26:40 PM »

And you might want to send to another address.
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
comrade693
Member
*
Posts: 13


View Profile
« Reply #14 on: December 31, 2004, 02:18:58 PM »

Ok, new try.

PHP.ini
Code:

[mail function]
; For Win32 only.
SMTP = smtp.itd.umich.edu
smtp_port = 25

; For Win32 only.
sendmail_from = sdwilsh@umich.edu


test.php
Code:

<?php

mail
&#40;"swilsher@ooslsoccer.org", "My Subject", "Line 1\nLine 2\nLine 3"&#41;;

?>


and the verdict...
Quote

[31-Dec-2004 09:13:56] PHP Warning:  mail(): Failed to connect to mailserver at "smtp.itd.umich.edu" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\Apache Group\Apache2\htdocs\test.php on line 3


I guess I need to try and setup a mail server on my computer now...

I appreciate your help!
Logged
Pages: [1] 2 3
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!