# PHP and MAIL()

**URL:** <https://forum.kirupa.com/t/php-and-mail/69949>\
**Category:** web dev\
**Created:** [November 9, 2004, 1:52pm UTC](https://forum.kirupa.com/t/php-and-mail/69949 "2004-11-09T13:52:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![terrym](https://avatars.discourse-cdn.com/v4/letter/t/ed8c4c/32.png) [@terrym](https://forum.kirupa.com/u/terrym)\
**Post date:** [November 9, 2004, 1:52pm UTC](https://forum.kirupa.com/t/php-and-mail/69949/1 "2004-11-09T13:52:11Z")

</div>

Hi  
I am trying to create a simple login script, a bit like that used on this site, which will email someone who is creating a New Account. I have used the three variables for MAIL() such as [font=Courier New][color=#0000cc]mail[/color][color=#006600]([/color][color=#0000cc]$fromEmail[/color][color=#006600], [/color][color=#0000cc]$Subject[/color][color=#006600], [/color][color=#0000cc]$nMessage),[/color][color=black] [font=Verdana]but not as shown in the [size=4][color=#003366] **PHP** [font=Verdana] Mail Form[/font][/color][/size] tutorial elsewhere on this site, which goes like this: [/font][font=Courier New][color=#0000cc]mail[/color][color=#006600]([/color][color=#0000cc]$fromEmail[/color][color=#006600], [/color][color=#0000cc]$Subject[/color][color=#006600], [/color][color=#0000cc]$nMessage[/color][color=#006600].[/color][color=#cc0000]"  
From: “[/color][color=#006600].[/color][color=#0000cc]$fromName[/color][color=#006600].[/color][color=#cc0000]”\<"[/color][color=#006600].[/color][color=#0000cc]$fromEmail[/color][color=#006600].[/color][color=#cc0000]"\>"[/color][color=#006600]);[/color][/font][/color][/font]  
[color=black]Whenever I test the script using the first example above, I get this error message: [/color]  
**Warning** : mail(): Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp\_port” setting in php.ini or use ini\_set() in **c:\inetpub\wwwroot ullah\users\register.php** on line **120**  
My php.ini contains the following:  
[mail function]  
; For Win32 only.  
SMTP =localhost  
smtp\_port = 25  
; For Win32 only.  
;sendmail\_from = [me@example.com](mailto:me@example.com)  
sendmail\_from = [terence.mold@ntlworld.com](mailto:terence.mold@ntlworld.com)

[color=black]Does anyone know what I am doing wrong here?[/color]  
Thanks
