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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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? :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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