[wp-hackers] Adding phpmailer options (smtp for example)

DD32 wordpress at dd32.id.au
Thu Aug 30 12:15:16 GMT 2007


Maybe a simple check can be done..

if( null === @mail('','','') ){
echo "Mail() is disabled";
} else {
echo "Mail() is available";
}

If mail() is disabled due to a disabled functions, then it returns null,
Else, It'll return false because the parametres passed are invalid.
(At least on PHP 5.2.3)

Just a thought for if it goes into core or a plugin.

On Thu, 30 Aug 2007 22:04:09 +1000, DD32 <wordpress at dd32.id.au> wrote:

> Being such a simple thing, I thought having it in core would be best, However, It does only affect a very small number of users, So maybe plugin would be better.
> But should a user have to install a plugin simply to get mail working correctly because of the server configuration? Generally WP tends to try to accomodate the most users(Such as the Backwards compatibility to PHP 4.3).
>
>
> On Thu, 30 Aug 2007 21:57:56 +1000, Callum Macdonald <lists.automattic.com at callum-macdonald.com> wrote:
>
>> G'day,
>>
>> It would be possible to add it as a plugin. The change is only 2-4 lines
>> of code though, you simply comment out one line and add another 2 (4 if
>> you're using SMTP auth). I figured it would make sense to make it
>> available to all users rather than offering it as an add on.
>>
>> However, happy to go with the consensus. So far I count +2 for a plugin.
>> Omry, do you have a view on it? Anyone else?
>>
>> Cheers,
>>
>>
>> Callum.
>>
>> Peter Westwood wrote:
>>>
>>> On 29 Aug 2007, at 23:46, Callum Macdonald wrote:
>>>
>>>> One of our sites had an issue today where it was dying with the error:
>>>> The e-mail could not be sent.
>>>> Possible reason: your host may have disabled the mail() function...
>>>>
>>>> Investigating, I realise that phpmailer is bundled with WordPress and
>>>> it's configured to use PHP's mail() function by default. That seems
>>>> sensible, however, I think it would be useful to add some options to
>>>> allow the user to configure it's use. For example, to send mail by
>>>> SMTP and then specify a host (even a username/password).
>>>>
>>>> Before I bash out some code and send a patch, I thought I'd ask for
>>>> feedback. Can anyone see any flaws in this plan? Would the options be
>>>> best implemented in the options database? Which admin screen would be
>>>> most relevant? If the user specifies an invalid server, how will that
>>>> affect the system? Is that more or less likely than mail() being
>>>> disabled?
>>>>
>>>> I think the current default is sensible, but options would be useful.
>>>> If I don't hear anything in the next few days I'll write some code
>>>> anyway and we can take it from there.
>>>
>>> I don't think this kind of configuration is needed for 90% of users.
>>> Therefore it would be better as a plugin.
>>> I would suggest you try and write a plugin to achieve what you require.
>>> If you find you need extra actions/filters in WordPress in order to
>>> achieve the functionality within the plugin then let us know (tickets
>>> in trac) and I am sure they will be added.
>>>
>>> Cheers
>>>
>>> westi
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list