name1090 Posted June 16, 2008 Share Posted June 16, 2008 When i pass an invalid email address like fiskhkas@dslk,com to the mail funtion, it provides a message which is directly echoed in the browser. There by exposing my directory path in the server to the user Like this /var/chroot/home/content/foo/dead.letter... Saved message in /var/chroot/home/content/foo/dead.letter I even put @ operator presiding the mail function. But still the message is displayed... How to avoid this message? Please help me Quote Link to comment Share on other sites More sharing options...
revraz Posted June 16, 2008 Share Posted June 16, 2008 Use Regex to not pass a invalid email? Try turning off error reporting in the php.ini if you want, but that seems pointless to allow invalid email formats. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 16, 2008 Share Posted June 16, 2008 For a production server, I wouldn't turn off error reporting, but you should definitely set "display_errors" to off. That way errors are logged but not displayed. Also, if you just want to suppress that specific error, you can always put an @ sign in front of the function: $rval = @mail($to,$subject,$body); Quote Link to comment Share on other sites More sharing options...
name1090 Posted June 16, 2008 Author Share Posted June 16, 2008 yes i have used @ operator. display_errors also setted to off. But this is not an error. It is just a message that the dead letter was saved in that directory path. So operator @ doesnt worked. I dont know about regex. is there anyother way? But how to avoid this message? Please help me... Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 16, 2008 Share Posted June 16, 2008 Ah, didn't read the error thoroughly....it's a sendmail error (i have no idea why it's coming through). It looks like you can configure sendmail to not save those dropped letters: http://docs.hp.com/en/B2355-91064/ch02s02.html#v1185579 You may also be able to set the ErrorMode somehow: http://www.sendmail.org/~ca/email/man/sendmail.html Quote Link to comment Share on other sites More sharing options...
name1090 Posted June 16, 2008 Author Share Posted June 16, 2008 Thanks. But how to set DeadLetterDrop. In my server, PHP not runs as a module. I have access to php5.ini only. I think i cant configure DeadLetterDrop through php5.ini. right? Then how to avoid saving dead letters? or just to avoid that display message 'saved dead letter in.....'? Please help me.... Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 16, 2008 Share Posted June 16, 2008 Is this through a hosting service? If so, this is the point where you have to call them and tell them your problem. They are the only ones that can fix it/provide workarounds. You pay them, might as well make them do some work, right? Quote Link to comment Share on other sites More sharing options...
webent Posted June 16, 2008 Share Posted June 16, 2008 Or you could always switch to webhostfreaks.com ... never have to worry about stuff like that happening... Just my opinion... Quote Link to comment Share on other sites More sharing options...
name1090 Posted June 16, 2008 Author Share Posted June 16, 2008 Yes, i am in a paid hosting. Ok sure i will let them know about this. In the mean time, can you please provide me details about using regex to validate an email address? how to validate an email address using regex? This will enhance my 'sign up' validation greatly. Please provide me with a code, if you can... Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 16, 2008 Share Posted June 16, 2008 <?php $email = 'fiskhkas@dslk.com'; $regex = '/^([a-z0-9]([a-z0-9_-]*\.?[a-z0-9])*)(\+[a-z0-9]+)?@([a-z0-9]([a-z0-9-]*[a-z0-9])*\.)*([a-z0-9]([a-z0-9-]*[a-z0-9]+)*)\.[a-z]{2,6}$/'; if(!preg_match($regex,$email)) die("Invalid Email"); echo 'looks good'; ?> another option for newer versions of PHP: http://www.php.net/manual/en/function.filter-var.php Quote Link to comment Share on other sites More sharing options...
name1090 Posted June 16, 2008 Author Share Posted June 16, 2008 Thanks a lot. I will go with regex instead of filter_var. I have gone through some regex manuals earlier but not able to get familiar with it. ??? Nice regex coding. but i cant understand it. No problem. I just need to make that work. thats all. Thanks....... Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 16, 2008 Share Posted June 16, 2008 haha...i didn't write that regex, found it in a google search Quote Link to comment Share on other sites More sharing options...
name1090 Posted June 16, 2008 Author Share Posted June 16, 2008 Thats good. google search for all! i am a google user too who loves to search web through google. Wondering whether this will work! ok lets give it a try. i will use it in my script. Tested with some invalid addresses and it seems to work nicely... Anyway thanks for searching it. Quote Link to comment 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.