redarrow Posted January 2, 2009 Share Posted January 2, 2009 how do i setup the smtp info for the php.ini please.. php snippet of smtp code to auth email it works but i want to setup the smtp for the php.ini so i dont have to keep using the auth code. $smtpServer = "smtp.blueyonder.co.uk"; $port = "25"; $timeout = "30"; $username = "redarrow"; $password = "redarrow"; $localhost = "localhost"; $newLine = "\r\n"; php.ini no password or username in the php.ini file. [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ; For Win32 only. sendmail_from = [email protected] how can i setup the username password and email from my provider, there no username or password in the php.ini how it done please cheers. Link to comment https://forums.phpfreaks.com/topic/139144-phpini-help-please/ Share on other sites More sharing options...
redarrow Posted January 2, 2009 Author Share Posted January 2, 2009 PHP mail() command does not support authentication. THAT AMAZING WHY NOT. I GOT TO USE THIS LONG PHP SCRIPT BECOUSE PHP DOSENT SUPPORT AUTH WHY NOT? <?php //new function $to = "[email protected]"; $nameto = "me"; $from = $to; $namefrom = "me"; $subject = "Hello World Again!"; $message = "World, Hello!"; authSendEmail($from, $namefrom, $to, $nameto, $subject, $message); ?> <?php /* * * * * * * * * * * * * * SEND EMAIL FUNCTIONS * * * * * * * * * * * * * */ //Authenticate Send - 21st March 2005 //This will send an email using auth smtp and output a log array //logArray - connection, function authSendEmail($from, $namefrom, $to, $nameto, $subject, $message) { //SMTP + SERVER DETAILS /* * * * CONFIGURATION START * * * */ $smtpServer = "smtp.blueyonder.co.uk"; $port = "25"; $timeout = "30"; $username = "username"; $password = "password"; $localhost = "localhost"; $newLine = "\r\n"; /* * * * CONFIGURATION END * * * * */ //Connect to the host on the specified port $smtpConnect = fsockopen($smtpServer, $port, $errno, $errstr, $timeout); $smtpResponse = fgets($smtpConnect, 515); if(empty($smtpConnect)) { $output = "Failed to connect: $smtpResponse"; return $output; } else { $logArray['connection'] = "Connected: $smtpResponse"; } //Request Auth Login fputs($smtpConnect,"AUTH LOGIN" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['authrequest'] = "$smtpResponse"; //Send username fputs($smtpConnect, base64_encode($username) . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['authusername'] = "$smtpResponse"; //Send password fputs($smtpConnect, base64_encode($password) . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['authpassword'] = "$smtpResponse"; //Say Hello to SMTP fputs($smtpConnect, "HELO $localhost" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['heloresponse'] = "$smtpResponse"; //Email From fputs($smtpConnect, "MAIL FROM: $from" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['mailfromresponse'] = "$smtpResponse"; //Email To fputs($smtpConnect, "RCPT TO: $to" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['mailtoresponse'] = "$smtpResponse"; //The Email fputs($smtpConnect, "DATA" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['data1response'] = "$smtpResponse"; //Construct Headers $headers = "MIME-Version: 1.0" . $newLine; $headers .= "Content-type: text/html; charset=iso-8859-1" . $newLine; $headers .= "To: $nameto <$to>" . $newLine; $headers .= "From: $namefrom <$from>" . $newLine; fputs($smtpConnect, "To: $to\nFrom: $from\nSubject: $subject\n$headers\n\n$message\n.\n"); $smtpResponse = fgets($smtpConnect, 515); $logArray['data2response'] = "$smtpResponse"; // Say Bye to SMTP fputs($smtpConnect,"QUIT" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['quitresponse'] = "$smtpResponse"; } ?> I HOPE PHP 6 GOT IT THERE ....... IT MY PHP.INI THAT SILLY Link to comment https://forums.phpfreaks.com/topic/139144-phpini-help-please/#findComment-727750 Share on other sites More sharing options...
redarrow Posted January 2, 2009 Author Share Posted January 2, 2009 Please tell me why php does not let user's add there own username and password if they need to. there must be a c++ plug in to achieve this or some psudo code. Is there a real reason for not having this option in the php.ini i am so shocked were not allowed this function added to the php.ini. come on. I understand the settings currently use a mail server, but as time go on, mail require auth, so why not add a setting in the php.ini for non mail server user's or users that require auth to send mail. sorry but to send a auth smtp email seems to be a big issue just add it to the php.ini Link to comment https://forums.phpfreaks.com/topic/139144-phpini-help-please/#findComment-727759 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.