manix Posted August 1, 2011 Share Posted August 1, 2011 Hey, I want to ask how can I actually send emails using php ? All tutorials show on how to send emails via outlook and I don't want that, I want to send emails from say [email protected], how do I do that ? Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/ Share on other sites More sharing options...
voip03 Posted August 1, 2011 Share Posted August 1, 2011 mail() function http://www.w3schools.com/PHP/php_ajax_database.asp http://php.net/manual/en/function.mail.php Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250360 Share on other sites More sharing options...
manix Posted August 1, 2011 Author Share Posted August 1, 2011 Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\test2.php on line 6 Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250365 Share on other sites More sharing options...
voip03 Posted August 1, 2011 Share Posted August 1, 2011 Open the “php.ini“ Search for the attribute called “SMTP” in the php.ini file. “SMTP=localhost“. change the localhost to the smtp server name of your ISP “smtp_port” which should be set to 25 http://www.phpfreaks.com/forums/index.php?topic=340060.msg1603137#msg1603137 Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250368 Share on other sites More sharing options...
IrOnMaSk Posted August 1, 2011 Share Posted August 1, 2011 what's the code or example you follwing? most likely you haven't enable all the stuff in php.ini Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250370 Share on other sites More sharing options...
manix Posted August 1, 2011 Author Share Posted August 1, 2011 how do I get my exact ISP name without having to contact them? I'm using a rooter Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250371 Share on other sites More sharing options...
IrOnMaSk Posted August 1, 2011 Share Posted August 1, 2011 how do I get my exact ISP name without having to contact them? I'm using a rooter who's your ISP? What mailing are you using? gmail, yahoo, hotmail? you can just search for their mailing server online Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250374 Share on other sites More sharing options...
manix Posted August 1, 2011 Author Share Posted August 1, 2011 I'm using abv.bg, I don't get what I need to change :/ Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250375 Share on other sites More sharing options...
IrOnMaSk Posted August 1, 2011 Share Posted August 1, 2011 I'm using abv.bg, I don't get what I need to change :/ what is your email address you using to send the email? for example '[email protected]' what's your domain.com? after the @sign Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250377 Share on other sites More sharing options...
manix Posted August 1, 2011 Author Share Posted August 1, 2011 yeah it's abv.bg ... >.> [email protected] Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250379 Share on other sites More sharing options...
IrOnMaSk Posted August 1, 2011 Share Posted August 1, 2011 so you need their outgoing mail server, and port number a quick search I found that this is their out going mail server : smtp.abv.bg and their port is : 465 so go to your php.ini (in your xamp folder) and search for: SMTP=localhost (change the localhost to smtp.abv.bg) and the port number, change it to 465 lastly they use secure socket layer ssl search for 'extension=php_openssl.dll' and uncomment it by delet the ; infront of it.... follow so far? if that's not working you have to confirm with their outgoing mail server that's it's definitly smtp.abv.bg Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250385 Share on other sites More sharing options...
manix Posted August 1, 2011 Author Share Posted August 1, 2011 erm still giving me that error, but this doesn't make sense, how can I send an email from some account without entering the password ? Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250387 Share on other sites More sharing options...
IrOnMaSk Posted August 1, 2011 Share Posted August 1, 2011 Hey, I want to ask how can I actually send emails using php ? All tutorials show on how to send emails via outlook and I don't want that, I want to send emails from say [email protected], how do I do that ? oh, you can't send email using somebody else's address!!! lol I was assuming you're using your own email address... and yes you need the password, if its your email address use your password to that address. and can you post the source code that you're working with? Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250390 Share on other sites More sharing options...
manix Posted August 1, 2011 Author Share Posted August 1, 2011 Well it is my e-mail I just haven't input the password anywhere O.o mainly cuz I dunno where (embarassed right now) I'm just testing it, trying to get it to work <? mail('[email protected]', 'subject', 'message'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250391 Share on other sites More sharing options...
IrOnMaSk Posted August 1, 2011 Share Posted August 1, 2011 don't be embarassed... if you don't ask you don't know this code is wrong <? mail('[email protected]', 'subject', 'message'); ?> that's not all the code that neccessary to send email... It need heading in there... here follow this example... http://www.w3schools.com/PHP/php_mail.asp and don't forget to do the setting from here so go to your php.ini (in your xamp folder) and search for: SMTP=localhost (change the localhost to smtp.abv.bg) smtp_port = (after the = replace with 465) sendmail_from = [email protected] (your email addres the [email protected]) lastly they use secure socket layer ssl search for 'extension=php_openssl.dll' and uncomment it by delet the ; infront of it.... let me know Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250398 Share on other sites More sharing options...
manix Posted August 1, 2011 Author Share Posted August 1, 2011 I don't get it again... this is my line <? mail('[email protected]', 'subject', 'message', 'From:[email protected]'); ?> and I get this Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() here's the php.ini [mail function] ; For Win32 only. ; http://php.net/smtp SMTP = smtp.abv.bg ; http://php.net/smtp-port smtp_port = 465 ; For Win32 only. ; http://php.net/sendmail-from ;sendmail_from = [email protected] Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250405 Share on other sites More sharing options...
IrOnMaSk Posted August 1, 2011 Share Posted August 1, 2011 the error show that the changes is not saved... You still have localhost as your smtp and the port is the still 25... it should be SMTP = smtp.abv.bg and smtp_port = 465. Make sure that those two are changes... go back in there see if the two lines are changed. if not change it and saves and restart the xamp server... after that try this one for me... just copy and paste it into your page. and run it (assuming that "[email protected]" is a real email address) $to = "[email protected]"; $subject = "mail testing"; $message = "Did you get this message?"; $headers = "MIME-Version: 1.0" . "\r\n"; $headers.= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= 'From: <[email protected]'>' . "\r\n"; mail($to,$subject,$message,$headers); most important make sure the smtp and the port is changed and saved Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250416 Share on other sites More sharing options...
IrOnMaSk Posted August 1, 2011 Share Posted August 1, 2011 oh and this line also ";extension=php_openssl.dll" delete the ; infront of it Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250417 Share on other sites More sharing options...
manix Posted August 1, 2011 Author Share Posted August 1, 2011 Erm okay I restarted the server and now my code loads forever and nothing happens, your code gives this Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\test2.php on line 13 the line that I am supposed to remove the ; from does not exist :/ EDIT: and yes both emails are mine and exist EDIT2: I fixed some typos in your code and it loads forever too now Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250418 Share on other sites More sharing options...
IrOnMaSk Posted August 1, 2011 Share Posted August 1, 2011 I tried Xamp and hated it lol... been using Wamp you sure couldn't find ;extension=php_openssl.dll ? try to search ssl in php.ini but we're getting somewhere: the error just checking to see that we have the from: in the header... so after restart the server, test it see wat's the error is. I have one more solution... and if you could post all the code in the test2.php here it would be great help for me !!! cuz then i know what's in line 13 that gave the error Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250428 Share on other sites More sharing options...
manix Posted August 1, 2011 Author Share Posted August 1, 2011 It doesn't find ssl either, I tried finding it, believe me. Here are all php extensions whatever that is (I guess it's supposed to be there) extension=php_bz2.dll ;extension=php_curl.dll ;extension=php_dba.dll extension=php_mbstring.dll extension=php_exif.dll ;extension=php_fileinfo.dll extension=php_gd2.dll extension=php_gettext.dll ;extension=php_gmp.dll extension=php_imap.dll ;extension=php_interbase.dll ;extension=php_ldap.dll ;extension=php_mssql.dll ;extension=php_mysql_mysqlnd.dll extension=php_mysql.dll ;extension=php_mysqli_mysqlnd.dll extension=php_mysqli.dll ;extension=php_oci8.dll ;extension=php_pdo_firebird.dll ;extension=php_pdo_mssql.dll ;extension=php_pdo_mysql_mysqlnd.dll extension=php_pdo_mysql.dll extension=php_pdo_odbc.dll ;extension=php_pdo_pgsql.dll extension=php_pdo_sqlite.dll ;extension=php_pdo_sqlite_external.dll ;extension=php_pgsql.dll ;extension=php_pspell.dll ;extension=php_shmop.dll ;extension=php_snmp.dll extension=php_soap.dll extension=php_sockets.dll extension=php_sqlite.dll extension=php_sqlite3.dll ;extension=php_sybase_ct.dll ;extension=php_tidy.dll extension=php_xmlrpc.dll [PECL] extension=php_ming.dll ;extension=php_pdo_oci.dll ;extension=php_pdo_oci8.dll and it's not giving me any error it's just loading like when you have an inifinite loop here's the file <html> <head> </head> <body> <? // mail('[email protected]', 'super si gotin', 'naistina e taka', 'From:[email protected]'); $to = "[email protected]"; $subject = "mail testing"; $message = "Did you get this message?"; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= 'From: <[email protected]>' . "\r\n"; mail($to,$subject,$message,$headers); ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250434 Share on other sites More sharing options...
IrOnMaSk Posted August 1, 2011 Share Posted August 1, 2011 oh forget about extension=php_openssl.dll, it's built into the xamp not like wamp... so when you test the page, it came up blank right? that's not a loop, there's no loop in the code... if there's no error, check your email it should be there with the "Did you get this message?" message in the body of the email... if you want to see if the email sent just echo "email sent" after the mail(); let me know Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250448 Share on other sites More sharing options...
manix Posted August 1, 2011 Author Share Posted August 1, 2011 no man, it's not sent the page loads, I get the loading cursor and the refresh button is disabled so it's still loading Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250452 Share on other sites More sharing options...
IrOnMaSk Posted August 1, 2011 Share Posted August 1, 2011 in that case it's not loading lol it probly is freezing ... so your xamp server is back up right? Probly need to x out that browser and retest it. if you're using windows, you're prbly need to restart the whole computer... restart usually fix 90% the problems in windows Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250456 Share on other sites More sharing options...
manix Posted August 1, 2011 Author Share Posted August 1, 2011 restart usually fix 90% the problems in windows amen lol Forget xampp (by your words I guess ms invented xampp lol) My hosting provider is supposed to have those settings configured I guess, all I wanna know is are you sure this is the correct syntax to send an email, because what's bothering me is how can I send an email from [email protected] without entering the password anywhere? Quote Link to comment https://forums.phpfreaks.com/topic/243511-actual-emailing/#findComment-1250464 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.