You are here: Re: function will not send mail! « PHP Programming Language « IT news, forums, messages
Re: function will not send mail!

Posted by Tobierre on 11/22/05 16:44

Hi phil,

Thanks for that. Got rid of the PHP mail parser warning, but even with your
suggestion it will still not send the e-mail! the error check returns
false!!

Got another suggestion? as I'm fresh out today

Tobierre

<invalid@invalid.invalid> wrote in message
news:BFA8BBEB.3B5FF%invalid@invalid.invalid...
> "Tobierre" wrote:
>
>> I've created the below function to automatically send me an alert in
>> outlook
>> when someone completes various forms on my website.
>>
>> The problem though is that mail reports that I have only 1 of the 3
>> required
>> parameters defined!
>>
>> I have no idea where this is going wrong, because as far as I can tell I
>> have defined all 3 parameters! Can anyone spot the problem?
>
> Try this (and see if you can spot the changes):
>
> <?php
> function alert_outlook($Type)
> {
> $Type = strtolower($Type);
>
> switch($Type)
> {
> case 'newsletter':
> $Subject = 'message subject one here';
> $Alert = "Hi,\n Just thought you would like to know that there has been
> another subscription to the newsletter!\n\n";
> break;
> default:
> $Subject = 'no subject';
> $Alert = '';
> }
>
> $Alert = wordwrap($Alert, 65);
>
> //set headers etc
> $Recipient = "Auto Alerts <AutoAlerts@domain.com>";
>
> $Message = "$Alert\n\n\n";
> $Message .= 'Date: ' . date("l, js F Y") . "\n";
> $Message .= 'Time: ' . date("H:i:s") . "\n";
> $Message .= 'IP Address: ' . $_SERVER['REMOTE_ADDR'] . "\n\n";
>
> $Headers = "From: Auto Mailer <AutoMailer@Domain.com>";
>
> mail("$Recipient, $Subject, $Message, $Headers");
>
> //error check
> if(!mail("$Recipient, $Subject, $Message, $Headers"))
> {
> return FALSE;
> }
> else
> {
> return TRUE;
> }
> }
> ?>
>
> --
> phil [dot] ronan @ virgin [dot] net
> http://vzone.virgin.net/phil.ronan/
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация