NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming > CODE
Reload this Page Hate php's bulit in mail function? I do! Here!

CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here.

Advanced Search
7 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 06-24-2004, 11:39 AM THREAD STARTER               #1 (permalink)
Account Suspended
 
axilant's Avatar
Join Date: May 2004
Location: /etc/passwd
Posts: 2,178
axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold
 

Member of the Month
July 2005

Hate php's bulit in mail function? I do! Here!


If you dont know anything about php, please contact me if you need help. This is very basic to use. If your good at php and still need help please contact me via pm.

PHP Code:
<?php 
//some little vars
$cfg = array(); // dont delete or edit  this
$cfg[sitedomain] = ""//your domain used, used for the noreply

//to use this:
  // $toArray format --> array("Name1" => "address1", "Name2" => "address2", ...)
//$toArray will carry the addresses you will be sending to and names
function socketmail($toArray$subject$message) {



  
ini_set(sendmail_from"root@$cfg[sitedomain]");

  
$connect fsockopen (ini_get("SMTP"), ini_get("smtp_port"), $errno$errstr30) or die("Could 

not talk to the sendmail server!"
);
   
$rcv fgets($connect1024);

  
fputs($connect"HELO {$_SERVER['SERVER_NAME']}\r\n");
   
$rcv fgets($connect1024);

  while (list(
$toKey$toValue) = each($toArray)) {

   
fputs($connect"MAIL FROM:$cfg[admin_email]\r\n");
     
$rcv fgets($connect1024);
   
fputs($connect"RCPT TO:$toValue\r\n");
     
$rcv fgets($connect1024);
   
fputs($connect"DATA\r\n");
     
$rcv fgets($connect1024);

   
fputs($connect"Subject: $subject\r\n");
   
fputs($connect"From: No-Reply <root@$cfg[sitedomain]>\r\n");
   
fputs($connect"To: $toKey  <$toValue>\r\n");
   
fputs($connect"X-Sender: <root@$cfg[sitedomain]>\r\n");
   
fputs($connect"Return-Path: <root@$cfg[sitedomain]>\r\n");
   
fputs($connect"Errors-To: <root@$cfg[sitedomain]>\r\n");
   
fputs($connect"X-Mailer: PHP\r\n");
   
fputs($connect"X-Priority: 3\r\n");
????: NamePros.com http://www.namepros.com/code/35719-hate-phps-bulit-mail-function-i.html
   
fputs($connect"Content-Type: text/plain; charset=iso-8859-1\r\n");
   
fputs($connect"\r\n");
   
fputs($connectstripslashes($message)." \r\n");

   
fputs($connect".\r\n");
     
$rcv fgets($connect1024);
   
fputs($connect"RSET\r\n");
     
$rcv fgets($connect1024);
  }

  
fputs ($connect"QUIT\r\n");
????: NamePros.com http://www.namepros.com/showthread.php?t=35719
   
$rcv fgets ($connect1024);
  
fclose($connect);
  
ini_restore(sendmail_from);
}

?>
Last edited by axilant; 09-08-2004 at 02:56 PM.
axilant is offline  
Old 06-25-2004, 05:25 PM   #2 (permalink)
Account Closed
Join Date: Jun 2004
Location: Canada
Posts: 116
qedft is on a distinguished road
 



Ummm I'm not sure I'm grasping the concept of this topic... :-P
qedft is offline  
Old 07-01-2004, 04:40 PM   #3 (permalink)
Senior Member
Join Date: Apr 2004
Posts: 1,189
e39m5 is a jewel in the roughe39m5 is a jewel in the roughe39m5 is a jewel in the rough
 



to send mail through php without using the "mail" function
e39m5 is offline  
Old 07-01-2004, 04:52 PM   #4 (permalink)
Senior Member
 
iDeviseFlash's Avatar
Join Date: Jun 2004
Posts: 1,030
iDeviseFlash will become famous soon enoughiDeviseFlash will become famous soon enough
 



lol. thats self explanitory, hehe
__________________
~*~* SIG FOR SALE *~*~
Click here...
iDeviseFlash is offline  
Old 07-01-2004, 04:56 PM   #5 (permalink)
RJ
NamePros Admin


 
RJ's Avatar
Join Date: Feb 2003
Posts: 12,919
RJ Has achieved greatnessRJ Has achieved greatnessRJ Has achieved greatnessRJ Has achieved greatnessRJ Has achieved greatnessRJ Has achieved greatnessRJ Has achieved greatnessRJ Has achieved greatnessRJ Has achieved greatnessRJ Has achieved greatnessRJ Has achieved greatness
 



Find Marrow Donors! Cystic Fibrosis Parkinson's Disease
Awesome function. Thanks axilant!

I don't generally have a problem using PHP's built-in mail function, but on occasion I work with a client whose settings are off or it doesn't work reliably -- usually a Windows NT server. This could help in those situations.
__________________
Reach me at rj at namepros dot com
RJ is offline  
Old 07-03-2004, 09:12 PM THREAD STARTER               #6 (permalink)
Account Suspended
 
axilant's Avatar
Join Date: May 2004
Location: /etc/passwd
Posts: 2,178
axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold
 

Member of the Month
July 2005

If there privacy settings are incorrect, it intends to not send some times. It gets annoying, because people email me i didnt get my email with my confirmation link yet!, its been 5 days or something, since ive used this, nothing like that has happen
axilant is offline  
Old 07-05-2004, 10:12 AM   #7 (permalink)
Senior Member
Join Date: May 2003
Posts: 2,187
adam_uk is a jewel in the roughadam_uk is a jewel in the roughadam_uk is a jewel in the rough
 


Breast Cancer
shouldnt this
$cfg[sitedomain] = ""; your domain used, used for the noreply
be
$cfg[sitedomain] = ""; //your domain used, used for the noreply

??
adam_uk is offline  
Old 07-05-2004, 11:09 AM   #8 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,074
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
if i remember correctly php automatically accepts it as a comment if it comes after the ; but yes you are right I think it should have the slashes
__________________
Manage your portfolio using my new Domain Portfolio Management script.
Securing Your Domain Name From Theft
Peter is offline  
Old 07-05-2004, 11:16 AM   #9 (permalink)
Senior Member
 
iDeviseFlash's Avatar
Join Date: Jun 2004
Posts: 1,030
iDeviseFlash will become famous soon enoughiDeviseFlash will become famous soon enough
 



i love the mail function, but thats just imo
__________________
~*~* SIG FOR SALE *~*~
Click here...
iDeviseFlash is offline  
Old 07-10-2004, 08:48 AM   #10 (permalink)
www.SportsConvo.com
Join Date: May 2004
Posts: 2,623
jstep is a glorious beacon of lightjstep is a glorious beacon of lightjstep is a glorious beacon of lightjstep is a glorious beacon of lightjstep is a glorious beacon of light
 



I like this alternative

but no prob with mail function
jstep is offline  
Old 08-22-2004, 01:18 PM   #11 (permalink)
NamePros Regular
 
CreativeLogic's Avatar
Join Date: Sep 2003
Posts: 889
CreativeLogic has a spectacular aura aboutCreativeLogic has a spectacular aura about
 



I also found this on php's site a while back. I used it for myimgs.com to send out confirmation links due to the fact a lot of people said they were not recieving the emails.
__________________
Online Time Tracking :)
CreativeLogic is offline  
Old 08-22-2004, 01:52 PM   #12 (permalink)
Senior Member
 
csmaster2005's Avatar
Join Date: Mar 2004
Location: U.S.A.
Posts: 1,985
csmaster2005 is just really nicecsmaster2005 is just really nicecsmaster2005 is just really nicecsmaster2005 is just really nicecsmaster2005 is just really nicecsmaster2005 is just really nicecsmaster2005 is just really nicecsmaster2005 is just really nice
 



hmm the php mail function works properly if setup correctly, so people should be getting emails.

Also, it has to have the comment markers, because php doesn't automatically take it in as a comment, because you can do stuff like $blah="test"; $abc="def"; all on one line
csmaster2005 is offline  
Old 09-03-2004, 12:12 AM   #13 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,074
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
looks like I was thinking of the php.ini file

anything after the ; in that is considered a comment.
__________________
Manage your portfolio using my new Domain Portfolio Management script.
Securing Your Domain Name From Theft
Peter is offline  
Old 09-08-2004, 02:57 PM THREAD STARTER               #14 (permalink)
Account Suspended
 
axilant's Avatar
Join Date: May 2004
Location: /etc/passwd
Posts: 2,178
axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold
 

Member of the Month
July 2005

Originally Posted by adam_uk
shouldnt this
$cfg[sitedomain] = ""; your domain used, used for the noreply
be
$cfg[sitedomain] = ""; //your domain used, used for the noreply

??
fixed, thanks, And yes you can set it up, to have comments right after ; as long as theres not more than 1 spaces before it starts
axilant is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 07:06 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger