sayedsohail Posted August 17, 2007 Share Posted August 17, 2007 Hi everyone, I am developing an application using php on windows xp machine, which connects to my email hosting company using broadband with outlook express uploads downoads works fine. Than I thought why not generate email directly from php pages and send email for demo purpose. Unfortunately its not working. The steps i followed. 1. change php.ini (infact i tried my email hosting server aswell but none of this works) SMTP = smtp.gmail.com smtp_port = 465 ; For Win32 only. sendmail_from = tislog@gmail.com 2. Try to test a script <? $to = "sayedsalmansohail@yahoo.com"; $from = "tislog@gmail.com"; $result = mail($to,"Test message","This is my test message"); echo $result; ?> 3. When i run the code, the page is keep on running and shows no error. I don't know how to pass the smtp email account password. can anyone help please? Quote Link to comment https://forums.phpfreaks.com/topic/65404-solved-simple-email-from-local-machine-using-gmail-smtp-not-working/ Share on other sites More sharing options...
sayedsohail Posted August 18, 2007 Author Share Posted August 18, 2007 Hi guys, I found, ("class.phpmailer.php");, which works wonders, but i am just wondering if someone come across, fancy email forms using php. please advise, Quote Link to comment https://forums.phpfreaks.com/topic/65404-solved-simple-email-from-local-machine-using-gmail-smtp-not-working/#findComment-327404 Share on other sites More sharing options...
MadTechie Posted August 18, 2007 Share Posted August 18, 2007 i always recommend phpmailer.. is this topic closed now ? if so please click topic solved Quote Link to comment https://forums.phpfreaks.com/topic/65404-solved-simple-email-from-local-machine-using-gmail-smtp-not-working/#findComment-327414 Share on other sites More sharing options...
sayedsohail Posted August 18, 2007 Author Share Posted August 18, 2007 Sorry, i just got a last question, here I am trying to upload files from my email form, which works fine for uploading jpeg/gif format files, but i wish upload only pdf, htm or html files. Here is my code: Form: <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>Multiple image upload script</title> </head> <body > <? $max_no_img=4; // Maximum number of images value to be set here echo "<form method=post action=attach.php enctype='multipart/form-data'>"; echo "<table border='0' width='400' cellspacing='0' cellpadding='0' align=center>"; for($i=1; $i<=$max_no_img; $i++){ echo "<tr><td>Images $i</td><td> <input type=file name='images[]' ></td></tr>"; } echo "<tr><td colspan=2 align=center><input type=submit value='Send'></td></tr>"; echo "</form> </table>"; ?> <center><a href='http://localhost'>Back to Main Menu</a></center> </body> </html> Function which is checking the type of file, this is the bit i need some help, to allow .htm, .html, jpeg, pdf and doc files to upload. Attach.php checkType(); //------Check TYPE------\\ function checkType() { while(list($key,$value) = each($_FILES[images][type])){ strtolower($value); if($value != "image/jpeg" AND $value != "image/pjpeg" AND $value != "") { exit('Sorry , current format is <b>'.($value).'</b> ,only Jpeg or jpg are allowed.') ; } } checkSize(); } Quote Link to comment https://forums.phpfreaks.com/topic/65404-solved-simple-email-from-local-machine-using-gmail-smtp-not-working/#findComment-327447 Share on other sites More sharing options...
MadTechie Posted August 18, 2007 Share Posted August 18, 2007 you need to change this if($value != "image/jpeg" AND $value != "image/pjpeg" AND $value != "") { to if($value != "text/html" AND $value != "application/pdf" AND $value != "") { oh and the message exit('Sorry , current format is <b>'.($value).'</b> ,only html or pdf are allowed') ; EDIT: also please don't PM me the post... unless theirs private data and you trust me and i request it Quote Link to comment https://forums.phpfreaks.com/topic/65404-solved-simple-email-from-local-machine-using-gmail-smtp-not-working/#findComment-327449 Share on other sites More sharing options...
sayedsohail Posted August 18, 2007 Author Share Posted August 18, 2007 million thanks, i am almost there, sorry do i need to change anything here (enctype='multipart/form-dat'); as i am not sure what this is actually does? "<form method=post action=attach.php enctype='multipart/form-data'>"; Quote Link to comment https://forums.phpfreaks.com/topic/65404-solved-simple-email-from-local-machine-using-gmail-smtp-not-working/#findComment-327450 Share on other sites More sharing options...
MadTechie Posted August 18, 2007 Share Posted August 18, 2007 nope thats what i use most of the time EDIT Oppes change to "<form method='post' action='attach.php' enctype='multipart/form-data'>"; you missed the single quotes Quote Link to comment https://forums.phpfreaks.com/topic/65404-solved-simple-email-from-local-machine-using-gmail-smtp-not-working/#findComment-327451 Share on other sites More sharing options...
sayedsohail Posted August 18, 2007 Author Share Posted August 18, 2007 thanks for your prompt, i was really stick with this for a week. thanks i o you for your timely help. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/65404-solved-simple-email-from-local-machine-using-gmail-smtp-not-working/#findComment-327453 Share on other sites More sharing options...
MadTechie Posted August 18, 2007 Share Posted August 18, 2007 your welcome Quote Link to comment https://forums.phpfreaks.com/topic/65404-solved-simple-email-from-local-machine-using-gmail-smtp-not-working/#findComment-327454 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.