» Quick Links
You can make money on these forums
We Share profits with you
Google
Google Adsense
Google Adwords
YPN
Yahoo
MSN Search
Web Directories
Web Hosting
Web Hosting Offers
Hosting News
Suggestions
Link Building
Domain Names
PHP Forums
MySQL Forums
» More Links
OSP News
Reseller Hosting
Shared Hosting
Dedicated Servers
Google Adsense
Search Engine Marketing
Link Development
Affiliate Marketing


» Advertising
Multiple DC PR Check

Free SEO Tools


Go Back   Webmaster Forums > Website Developement / Programming > PHP Programming and Tips

PHP Programming and Tips Discuss about PHP programming and Share Tips. Ask questions about Scripting and Errors.

Reply
 
Thread Tools Display Modes
  #1  
Old 08-13-2006, 08:59 AM
hadlee hadlee is offline
Junior Member
 
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
hadlee is on a distinguished road
Red face The function efficient to send mail or not?

Please tell me is this function good to send mail

function sendEmail($To, $From, $Subject, $Body)
{
global $set_ini_smtp, $quiet,$from_address_mail;

mail("$To", "$Subject","$Body","From: $From <$From>\nX-Mailer: PHP 4.x\r\n\r\n");

return true;
}

Thanks -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Revenue Sharing Ads ( ?):
  #2  
Old 08-13-2006, 09:05 AM
daffy daffy is offline
OSP Starters
 
Join Date: Aug 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
daffy is on a distinguished road
Default

You are just doing a minor rewrite of the PHP mail function. I do not understand why you are including the globals. Unless you intend to use them you do not need them.

I also question adding the X-Mailer bit and the extra newlines. By putting in two newlines you are forcing everything below that line to be part of the email message body and NOT the header. I would just use:

function sendEmail($To, $From, $Subject, $Body)
{
mail($To, $Subject, $Body, "From: $From");
return true;
}

Less is better in email headers. -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
  #3  
Old 08-13-2006, 09:06 AM
qwerty qwerty is offline
OSP Starters
 
Join Date: Jul 2006
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
qwerty is on a distinguished road
Default

php Code:
<?php function send_email($to, $subject, $message, $headers){ // you may care to do some regex to filter out any sent shit mail($to, $subject, $message, $headers); return true;} ?> -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
  #4  
Old 08-13-2006, 09:08 AM
congo congo is offline
Junior Member
 
Join Date: Jul 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
congo is on a distinguished road
Default

Hi

I use SourceForge phpmailer. I own a mailform processor and I noticed that the mail function didn't always send my emails out when sending loads of emails.

Bye -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
  #5  
Old 08-13-2006, 09:11 AM
oneil oneil is offline
OSP Starters
 
Join Date: Jul 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
oneil is on a distinguished road
Default

The function mail() just puts your email in the queue of mail server (MTA). When your email will be sent out depends on how the queue is running. So the most effecient way of sending mail is to run the queue frequently. It doesn't matter how you code in PHP. -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
  #6  
Old 08-13-2006, 09:14 AM
49ers 49ers is offline
OSP Starters
 
Join Date: Jul 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
49ers is on a distinguished road
Default

The mail function described by daffy is perfect and i have been using it in same way for a long time and it is working fine for me. -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
mail through outlook!! Hliver Web Hosting Industry 1 10-16-2006 03:54 AM
to send 3k emails in one time!!! Jaxson Web Hosting Industry 1 08-07-2006 06:45 AM


All times are GMT. The time now is 08:55 AM.