Jump to content

[SOLVED] A mail() function message


name1090

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/110424-solved-a-mail-function-message/
Share on other sites

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);

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...

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

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....

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...

<?php
  $email = '[email protected]';
  $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

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.......

:o 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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.