Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Block Email Address / Domain From Using Email Form


I keep getting the same person spamming people on my website through my email form.

The email address is they keep using is sadlowski_lidia@o2.pl but this sometimes changes to a different name but still from the o2.pl domain

How can I block anyone using my email from the domain name o2.pl




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Preg_match To Block Email Address(es)
I have found the below code I change it to *.EXT instead of the ending of the email address for example *.com Now if someone had abc.EXT@my-domain.co.uk would the below code echo the message or would it let it pass and only block abc@my-domain.ext ?

Also does anyone know if it is case sensitive ? Finally how would I have to to check for .EXT and .EXT1 etc..., would I need to repeat the code or can I have it all within the same code, if so how ? Code:

Need Email Address From Submitted Html Email Form
I have an html email that contains a form with questions for the user to fill out. Without asking the user to re-input there email address into the form, is there a way for me to grab the email address its coming from when the user submits the form to the php processing program. I need a way to match the questions to the user when they submit the form.

Extract Email Address Domain From $_POST
I have a script that takes form data and posts to a DB. I have someone that is doing alot of fake posting and using weird email address all with my domain as part of the email address that they use. How can I use and if statement to ask if the domain is mine from $_POST[email] then do not allow the post if the domain is mine?

Send To Another Email Address With This Form?
How would i send this to another 2 email address of my choice in a blind cc? Code:

Email Array Checking Validity Of Email Address
I had the following working but since I changed the email variable to an array it doesn't work. email[] This is part of an edit form where emails in the mailing lists can get updated however, before they get updated i need to check that each of the email addresses are valid.But the code doesn't work for the array. Code:

Hiding The Receipeint Email Address While Sending Email
i am sending an email using php. i dont want the receipeints to see the to address. the problem is i am sending to a mailing list email address. so how can i hide the to address and the from address if possible?

Inserting Different Email Address Into Feedback Form
I have a website which contains "profiles" for around 200 small hostels and tour companies in South America.  each profile has a feedback form inserted into it using SSI which allows backpackers to send emails direct to the hostel/company.  When the submit button is pressed, it executes a PHP script (which I got off thesitewizard.com) to mail the form back direct to the company. 

Whilst the actual feedback form itself is one file, inserted into each profile, the PHP that executes is separate for each company - the only reason is because the email address differs for each company.

My main aim is to have the bulk of the PHP script as one file and somehow include the email address into the PHP script either using somekind of include() from a separate file or otherwise taking it as a variable in the profile page itself.

As I'm rubbish with PHP, I trawled the net and read through about a dozen tutorials regarding PHP include, but the script fails to execute when I do this.  The code I am using is:  <?php include("file.php"); ?>.

The include function definately works as I have tried creating a blank php file with just <?php include("file.php"); ?>  (where file.php is the FULL php script) in it and it executes perfectly.   However,  When I divide the script in two and put the first half in the document and follow it with <?php include("file.php"); ?>   eg...

<?
$mailto = "info@email.com";
<?php include("file.php"); ?>

I get an error message stating: Parse error: syntax error, unexpected '<' obviously because it can't handle the <? before the php include.

Is there a way in which you can insert plain text (ie an email address perhaps from a text file) into a PHP script?

Passing Form Data To An Email Address/Excel Sheet On A Local Computer
I am right now learning PHP & want to know if there is a way to send
web form data to an Excel sheet located on a network. My windows xp PC
doesnot have a copy of Excel. Also i am not connected to the internet,
its a local computer.

What i am trying to do is to make a PHP script which will send a simple
form data to an excel sheet (or create a new Excel sheet) on another PC
on a network.

Since i am not connected to the internet, i will not be able to send an
email (anyway, sendmail is not available on Windows OS), nor do i have
any server on windows.

Is it possible to send form data to Excel sheet on local computer? Even
my PC is a local PC. Some one was saying its possible thru Windows
Scheduler.

Email From Apache@domain.domain.com
I have tried sending mail with:

mail and imap. I know how to set "From" headers and this works fine when I send an email to an email. Heres the catch: when I send an email to a cell phone (i.e. 1234567890@vtext.com) it ignores the "From" header and says it is from apache@mydomain.mydomain.com.

Email To Email Information Form
im creating a php form so when a user come to my website and fills out questions like "how much would you like to spend", or "the product you would like to have is". so when all the questions are filled out and the put in their email address I can get back to them. I want the php to send me the form they just sent out to MY Email Address and i need the code to send them the same email that i got so they know what they filled out and they have it for their records also.

Email From Address
I want to send email through PHP mail function. i am passing headers for from address.
But it sends email address as Sender in yahoo. I want to print Name also as sender : Jeff.
PHP Code:

Getting Address From Email
How do you get the text between two characters, such as < and >? For example, you have the From: line in an email "Their Name <name@somewhere.com>", how would you get just the address part from it? I guess the preg thing is used here, but I don't understand it at all.

Can't Send Email To Same Domain As Server
I have encountered the following problem: I've made a site which, among other things, have a competition. Whenever this competition is drawn, the result (the winner) is send to the person that administrates the competition. It does, however not send an email.

I use a standard mail() function, I get no errors, it works fine when using other emailadresses than the ones that goes to the domain of the server (example - the server is www.myserver.com, the emails send to name@myserver.com doesn't arrive, emails send to anothername@myserver.com neither, but emails send to name@anotherserver.com works fine).
I have checked that the email adress is correct, and it recieves emails fine when sent using email program. The sites email server is not hosted the same place as the webserver.

Validating Email Address
ok, I have developed a PHP script which sends a user there password, kinda a forgot password type thing. Just one thing i really cant work out. I need to validate the email address to ensure it is URL rather than just anyold email address, ie. it must contain mydomain.com at the end of it.

so essentially all i need to do is grab the text from the email address field, trim the contents before that '@' and store this into a variable.

then an if loop, if the variable = 'mydomain.com' then execute the script, else diaply an error message

How would I go about doing this?

Email Address Verification
I am writing a great mailing list program that I will distribute for free that comes with email addresses, tracks what was sent to who, how many times, handles campaigns, etc. What I want to do is before a message is sent, the email address is pulled out of mySQL, verified that it is real by looking for the address on the internet, sending the message, and then recording stats in the mySQL DB. I have everything done except for the verification (real).

Verifying An Email Address
I'd like to check (for security purposes) that an email address entered in a text input is valid (ie it contains at least one. which must be after the @ and contains no semi-colons). How can I do this in PHP? I figured it can be done with Regular Expressions but they're not very well-documented in my PHP book.

Email Address Length
Does anyone know if there is a maximum allowable character length for email addresses? If so what is it?

Verify Email Address
how can i verify the email address entered by client?

is there any readily available function for that in php or mysql?

else suggest me some links for verifying email address enetered by
client.

Obtaining Email Address.
I have been a victim of a website ( coded using php ) managing to obtain my
email address just by visiting the website. I know get loads of rubbish via
that email account.

How have they managed to do this?

The reason i ask is so i can stop it. Oh and also being into php a bit i
would also like to try it out :) just for fun.

Verify Email Address
I am creating a registration form. There have a email field. After successfully complete a mail with activation link will send to the email. After clicking the activation link then he can login. So how can I do this?

Email From Address And Attachments?
mail($EmailTo, $Subject, $Body, $mail_header, "From: <$from>");

im trying to set the from address in an email, but when i do it with the above it doesnt work!  Instead it stops the header being set to HTML and shows that code.  Can any one tell me where im going wrong? Also how can i send attatchments with an email?

Sender's Email Address
I have a site on GoDaddy and have made a contact form using php/html. It's working great, however the customer's email address shows up in the body and the "from address" is some automatic address generated in the process. How can I have the customer's email address be the from address when receiving their request? Here is the code from the 2 pages involved. Code:

Valid Email Address Checking
Hey there. I need to check if a given email address is formatted correctly. I picked up this line somewhere

ereg("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*$", $email)

and it works, mostly. The big problem is that it allows addresses without a suffix. For instance, it allows "jaeger@hotmail", without the ".com". (This isn't my address.) I tried other invalid forms, and it caught them. I figured someone would already have a ereg string which works, so I won't bother trying to figure it out.

Parse A String With An Email Address
I need to parse a string with an embedded email address.
The string always has the format NAME (name@domain) SOMETEXT.
What I need to get is the email address as name@domain.

I came up with this (I know it's broken, but it's a first start):

<?php

function ParseTicketEmail($ticket)
{
global $TicketEmail;
for ($i=0; $i< strlen($ticket); $i++){
//we need to pass everything between ( and ) to $TicketEmail nothing else
do {
$ticket[$i] = $discarded;
} while ($ticket[$i] != '(');
while ($ticket[$i] != ')'){
$TicketEmail = $TicketEmail . $ticket[$i];
}
}
return $TicketEmail;
}

$ticket = "hello (world@world.com) bla";
print "$TicketEmail";
print "$discarded";
?>

But that doesn't return anything for either $TicketEmail or $discarded.
So:

a: why doesn't it return anything for either string? (It's too early in the morning here)

b: does anyone have such a function anywhere for me to check out for how to do it?

Remove Last Part Of Email Address
Is there a simple way to remove the last part of an email address using
PHP. I want to remove the @ symbol and everything to the right of it.
Any ideas?

Example:

thomas@xyz.com

should be:

thomas

Thanks!

Strip Email Address From Field?
I'm looking for a routine than can find any valid email address in a field and replace it with text. For example if the field was filled with "My email address is foo@foobar.com and I'm ugly" then the routine would change the text to: "My email address is newtext and I'm ugly" Any ideas on how to accomplish this?

Preg_match / Valid Email Address
Right now, I am doing this:

function sys_is_valid_email ($s) {
if (preg_match ("/^.+@.+..+$/", $s)) {
return 1;
} else {
return 0;
}
}

It works great, but it doesn't allow a number at the beginning.

For example
2cool@forme.jom can not be entered
1953@forme.jom can not be entered

but,
cool2@forme.jom can be entered
d1953@forme.jom can be entered

How To Use URL Variable To Decide Which Email Address To Use
I have a list of committee members on my classic car site with their email addresses for people to write questions to them.

But to avoid spam I would like to have just a button that says "email" and when the vistor pushes that a variable is passed into the URL. I then want a standard form to use that specific variable to decide which email address to use from a list.

eg I want a list of email address numbered 1 to 30 held in a file out of view of the visitors to the site. When the form page is loaded it will pick up that variable to decide which address from the list is to be used.

Preg_match_all Pattern For Email Address
I'm trying to flag and mask emails from a text string. I found this
on Zend but cannot get it to work. It is supposed to create an array
of email addresses but I think there is something wrong in the
'preg_match_all' call for the pattern. I cannot figure out if this
pattern is even correct.

function get_emails ($str)
{
$emails = array();
preg_match_all("/bw+@w+[.w+]+b/", $str, $output);
foreach($output[0] as $email) array_push ($emails, strtolower
($email));
if (count ($emails) >= 1) return $emails;
else return false;
}

# Here is how to use it.

# Sample string containing email addresses;
$str = "test test@... ha ha heHe@... bla bla bla@...";

# Get the emails on arrays;
$emails = get_emails ($str);

# Print that arrays;
print_r ($emails);

Secure Email Address Function
I am using the following email security script on many of my applications and I have just received an email today where someone told me that it doesn't work on about 80% of his emails. It doesn't work for domains that use .info and some other domain extensions.

How can I fix this. This is urgent as I am using this on contact forms, submission forms, etc. PHP Code:

How To Exclude A Specific Email Address
I wish to exclude a specific email address when one sends an ecard from my site.  How does one exlude this email address but allow all others to continue on their merry way?
Code currently used:

function validEmail($address)
{
if (eregi("^[a-z0-9]([._-]?[a-z0-9])*@[a-z0-9]([.-]?[a-z0-9])*.[a-z]{2,}$", $address))
return true;
else
return false;}

Verifying The Existence Of An Email Address
if (preg_match("/^[a-zA-Z_]+(w+)*((-w+)|(.w+))*@w+((.|-)w+)*.w+$/i",$Email)){
   $messages['ValidEmail'] = "* Your email address is valid, Your Registered! ";}
      else {
   $flag = "1";
   $messages['InvalidEmail'] = "* Your email address is not valid, please re-enter your email address.";

I tought the above would work but apparently it only checks the an email address has all its attributes (******@***.***)

it doesn't go check to see if the email is in existence..  what do i need to do to check the email existence?

Change From Address In Email Sent From Php Script
I have a strange problem that I'm not sure how to solve. I have a web form that collects name, email and message from users of my website. This info is posted to a php script which then emails the info to our email address.

The problem is, the from address never gets changed from webmaster@ourdomain.com. I haven't specified this address in the script at all and am adding extra headers to try and change the from address to the email addy specified by the user.. Code:

Can I Hide My Email Address In Require File
I am wanting to hide my email address so that a spammer cannot use one of their "crawlbots" to crawl the pages in my web site and steal my email address.

Can a spammer's crawlbot find my email address if I place my email address in an include file and place the include file somewhere like, for example, the configuration folder?

Error Handler With Email Address Defined Elsewhere ?
Without using globals, how would one use an email address defined elsewhere, from within an error handler function. I can t pass it in as an argument, and the variables outisde the function arent available within it.

Preg_match Problems For Email Address Validation
I've been working on some email validation code cause I couldn't find anything very accurate on the web to do this (the php.net stuff is junk <sorry>)I was wondering 2 things:

1. If anyone would find this useful .. feel free to "borrow" it ...
2. If anyone could be bothered .. could they look over this and give me any feedback on whether it seems accurate .. or if there are any glaring holes in the code ..

I know there are a few holes in it like not being able to detect double dots ".." in the address so if anyone has any ideas around this flaw please let me know. Code:

Checking If Email Address Is Live And Real?
There's all kinds of ways to validate an email address to make sure
it's well formed and whatnot, but what about checking to see if it's a
valid e-mail account?
Like how you can use checkdnsrr() to check to see if a URL is valid.

I know finger used to be used at one time, no? But server block finger
requests, and I'm not sure many e-mail accounts out there are even
fingerable type accounts anyway.

How To Extract An Email-address From A Text File
Can somebody show me a quick code snippet to reliably extract an
email-address form a text file ?

Forward Email, Change Sender Address
Is there anyway I can set up a personal 'remailer' type of thing
on my domain ?

I can not email a friend at his workplace because his company
have put a 'block' on emails from my work address (the companies
we work for are considered rivals) - I am after a way to
'bounce' or forward an email, so my originating address isn't
shown.

I have tried email forwarding (in CPanel) using addresses set up
in my domain but when they forward, the original sender is
shown, therefore the block applies.

I have also tried using Bigfoot but again, the original sender
is shown.

Is there any way, using PHP or otherwise, that I could somehow
receive a message sent to an address in my domain, and forward
it on with a different "from" address ? (There would only be 1
specified address that I would want to forward on, to prevent
abuse!)

i.e.

from xxxx@company1.com => xxxx@mydomain.com, this then forwards
the original mail but from xxxx@mydomain.com =>
xxxx@company2.com

Unfortunately webmail isn't an option as we don't have web
access at work, and it has to be sent through the work Email
system, Outlook.

Script Hide Email Address From Spambots?
Below is (a part of) a script that I am using on my web site. In order to guard against "spambots" I am including my email address in the "email_address.inc.php" require file.

I have the "conf" directory password protected. A "spambot" crawler can't get to it from a direct call (I don't think) because the directory is password protected. The script below will call the "email_address.inc.php" file just fine from the password protected directory.

The "Submit" button has to be activated and the input in the "$FirstName" and the "$LastName" input boxes has to be in the right format before the "email_address.inc.php" file will be called (using the code in the script).

My question is this: Does anybody see how a "spambot" could get into my "email_address.inc.php" file the way I have the code written below? PHP Code:

Hiding Email Address From Mail 'To' Column...
i have an application where i need to send an email within the system. i should not display the email address anywhere in the email. as of now, the way it shows up(on the recipients computer) when i send the email is. Code:

Max. Size Of Email Address List With Mailto: ?
I'm experiencing problems with a large Bcc: email address list.  I can't use PHP mail() right now, and I'm not sure I'll be able to in the future, so I'm trying to make my code work with HTML mailto:.  I'm finding that I can generate an email message in MS Outlook IF my Bcc: list is about 90 emails long.  Anything longer than that, and the email will not generate, and I get no error message. 

I'm not sure if there is a max. number of email addresses, or a max. number of characters.  I can MANUALLY cut and paste a list of 300+ email addresses into the Bcc: field in the email message, but I need to generate this email message via code. My code looks something like this:

">Generate Email with HTML mailto:

$emailBCCList = 'name1@domain.com,name2@domain.com,name3@domain.com,etc.'

I'll need to send out a single email that has approx. 300 or more Bcc: email addresses as part of a large invitation (this is NOT spam; these individuals have asked to be invited).

Email Sending From Address To Be Actual Sender's
I am using a script to send an email to me whenever someone registered in my custom make PHP script site. Following is the extract of the email sending function of my code.

The problem is I need this script to send the mail where from address should be the actual user’s address (i.e. if marcel34@hotmail.com register a new account I need this system to send the following mail that should look like coming from [email]

$FromName = $Email;
$ToEmail = $listmail;
$Message = "
Please subscribe me

User Name : " . $UserName . "
Mailing : " . $Mailing . "
Name : " . $CustomerName . "
Email : " . $Email . "

.....

Pulling Email Address From Database For Mail()
Maybe it's because it's late or maybe I'm just a newbie (couldn't be) but I'm having trouble with getting all the names from my database into my $to variable.

$sql_mail = "SELECT email
FROM players
WHERE email!= 'none'";
$result_mail = mysql_query($sql_mail);

//bunch of error message validation stuff...

//fetch email addresses from query
while($row_mail = mysql_fetch_assoc($result_mail)){
$to = $row_mail['email'].", ";
}
$subject = $_POST['subject'];
$headers .= "From: Me <email@site.com>";
$headers .= "Reply-To: email@site.com;
$message = $_POST['message'] . "";

//now before sticking $to in mail() now with my $headers, $subject and $message I figured that if I try that php will only include the first record.

echo $to; //returns first record as I figured.

How do I keep the list of emails from my while without having all the other stuff ($headers etc) repeat with every record?

Trouble Extracting Email Address From Text File
I'm trying to put together a script that will read an email box set up for newsletter bounces and remove the bad addresses.

There's an old script I've worked with that looks for --- Permanant fatal errro ---, but not all the bounced emails have that line included (3 out of about 700 do).

I need to find the bad address, then delete that address out of the database. I've got the deleting out of database down, but am not sure how to find any email address & delete it.

PHP::Auth Requiring Valid Email Address To Authenticate
I am about to implement an authentication system on the site I am
building. I don't care much what users choose for their username and
password, but I want to verify that users have given a valid email
address before allowing them access to restricted content. Will Auth
facilitate the email validation process, or does it only deal with
usernames and passwords?

I don't need to be told in detail how to do all this, but I'd like to
know early if I'm barking up the wrong tree by trying to use Auth with
this intention in mind. If so, is there a better package to use for
authentication that requires a valid email address?

Input Submitted Email Address Into Reply-to Field
When a bride clicks "submit", the form at http://www.estesparkweddings.com/contactus.shtml generates an email to all association members.  When a member receives the email, he wants to click "reply" and have the email reply to the email address submitted with the form (variable $confirmemail).  Below is the code I'm using to try to do it.  Currently, when an email is received and I click "reply" it generates an email to $confirmemail@box73.bluehost.com Code:

PHP Based Email Address Obfuscator For Website Mailto: Tags
I found a PHP based email obfuscator for use in websites, where the
source HTML (PHP, actually) file doesn't contain the actual email
address in the Mailto tag, but generates it and that generated page
(containing a full and conventional Mailto: tag) is what is ultimately
presented to the user.

The intent is to thwart Spam bots and spiders, by NOT having the email
address in the original HTML Source, but ultimately presenting it to
the person browsing the site.

But here's my question.... Even though the program works exactly as
advertised, isn't this a case of flawed logic on the part of this
scripts author? PHP runs server-side, so won't the PHP be
interpreted, whether it's requested by a bot, a spider, or a legit
website visitor? (and thereby, presenting the bot with the full
Mailto: tag and email address anyway)? Or is there something basic
I'm missing here?

Code Review: Does This Class Method Really Validate An Email Address?
I wrote a method that should check if an email address is valid. In
another method I've already checked to see if $_POST['email'] exists
and is well-formed, so those checks are not necessary in this scope.

However, "Step 4" bothers me, and I wonder if others are as bothered as
I am.

[PHP]
/**
* Validate submitted email
*
* @access private
* @see checkdnsrr
* @link
http://www.devshed.com/c/a/PHP/Email-Address-Verification-with-PHP/4/
* @see link regarding use of getmxerr() as a double-check behind
checkdnsrr
* @link http://us2.php.net/manual/en/function.fsockopen.php
* @see link regarding usage of fsockopen() for domain reachability
verification
*/
function &validateEmail() {// STATIC VOID METHOD
global $webmasterEmail;

list($user, $domain) = @explode('@', $_POST['email']);

if ($this->isValid && (!$user || !$domain)) {
$this->isValid = false;
$this->setErrorArray(array('email' => 'No validly formed email
address was found'));
}

// STEP 1: USE checkdnsrr (either built-in UNIX version or
"homegrown" version in client functions.inc.php for Windows)
if ($this->isValid && !checkdnsrr($domain) && !$_ENV['windir'] &&
!$_SERVER['windir']) {
// ONLY PRODUCE AN ERROR IF NOT IN WINDOWS ELSE ALLOW getmxrr() TO
THROW ERROR
$this->isValid = false;
$this->setErrorArray(array('email' => "Domain: "$domain" not found
to exist for email address to be valid"));
}

// STEP 2: MAKE SURE $domain IS NOT OUR DOMAIN
if ($this->isValid && strcmp(trim($domain),
preg_replace('/^([w]{3}[a-zA-Z0-9]*).?([a-zA-Z0-9-_.]+)$/i', '$2',
$_SERVER['SERVER_NAME'])) == 0) {
$this->isValid = false;
$this->setErrorArray(array('email' => "You are not allowed to use
our domain of "$domain" for your email address"));
}

// STEP 3: USE getmxrr() BUILT-IN PHP FUNCTION TO DOUBLE-CHECK BEHIND
STEPS 1 AND 2
if ($this->isValid && @!getmxrr($domain, $hostArray)) {
$this->isValid = false;
$this->setErrorArray(array('email' => "Domain: "$domain" is not
found to exist for the email address to be valid"));
}

// STEP 4: VERIFY VIA fsockopen() IF YOU CAN EVEN REACH THAT DOMAIN,
MEANING IT'S ACTIVE (COULD ALSO BE DOWN OR UNREACHABLE OR BOGUS)
if ($this->isValid) {
$socketID = @fsockopen($domain, 25, $errno, $error, 15);// LAST
NUMBER IS TIMEOUT FEATURE - TIMEOUT AFTER 15 SECS
if (!$socketID) {
$msg = "There was a problem attempting to connect to "$domain": "
.. nl2br($error) .
", please try again or contact our administrator at <a
href="mailto:$webmasterEmail">" .
str_replace('@', ' at ', $webmasterEmail) . '</a>'
$this->isValid = false;
$this->setErrorArray(array('email' => $msg));
}
@fclose($socketID);
}
}
[/PHP}


Copyright © 2005-08 www.BigResource.com, All rights reserved