WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Sending email with random details
Categories : PHP, Email, Debugging
Boaz Yahav
Date : Mar 12th 2005
Grade : 3 of 5 (graded 1 times)
Viewed : 3904
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Boaz Yahav
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

One may think that this is a great script for flooding someone with spam but this script is actually very useful when you need to stress test a new mail server. It is important to have the ability to fill mail boxes with emails that have random subjects, names and "from" so that you can test the sorting options of the mail box. Sorting is usually a heavy task on the mail server (in exchange for example) and if you fill a mail box with thousands of random emails you cause the mail server to work hard on sorting.

<?
$OneKBText
="123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 ";
$Recipient="user@domain.com";
$MailSize="1"; //in KB
$NumberOfEmails=1;

//Build Mail Body
For($i = 1 ; $i <= $MailSize ; $i++) {
   
$Text .= $OneKBText;
}
For(
$i=1 ; $i <= $NumberOfEmails ; $i++) {
   
$Title=md5(uniqid(rand()));
   
$FirstName=substr($Title,1,5);
   
$LastName=substr($Title,6,5);
   
$Domain=substr($Title,20,7);
   
$User=substr($Title,12,5);
   
mail("$Recipient","$Title","$Text","From:$FirstName $LastName <$User@$Domain.com>");
    Echo
"Sending Mail Number $i<BR>";
   
flush();
}
Echo
"<BR><BR><BR>*** Done sending mail ***<BR>";
?>



An email validation script that actually checks against the recipient's mail server.
Categories : Email, Complete Programs, PHP, Network, Debugging
Example of function to send out email if error occurs
Categories : PHP, Email, Debugging, Errors and Logging
The class to check load time of your script VERY usefull for relatively slow applications, but not only..
Categories : PHP, PHP Classes, Debugging
PhpView 0.1 - simple php viewer, using temporary files and frames.
Categories : PHP, PHP Options and Info, Debugging, HTML and PHP
Class for sending mail with MIME attachments in multipart format using external sendmail, mimencode and zip
Categories : Email, Network, PHP, PHP Classes
A web-based php3 IMAP email client supporting address books, attachements (downloading and sending), LDAP searching, and much much more.
Categories : Email, PHP, LDAP
Encoding data using PGP via PHP's proc_* functions
Categories : Cryptography, Security, Email, PHP, PGP
email new items in db
Categories : PHP, Email, Databases, MySQL, Beginner Guides
PHP based Contact email form with multiple recipients, text file based, supports departments.
Categories : PHP, Email, Beginner Guides, Filesystem
email validator check checker email e-mail email address
Categories : PHP, Email, Regexps
Mail-lib provides a simple interface to the sendmail program. Note: you must actually have sendmail on your machine (sorry windows NT users).
Categories : Algorithms, Email, PHP
PHPRecommend v1.0 - "Recommend this page to a friend" script written in PHP. Easy to install
Categories : PHP, URLs, Complete Programs, Email, Site Planning
Function to check connection to MySQL and redirect to an error page if an error occurs
Categories : MySQL, PHP, Debugging, Databases
validateEmail 2.0 - upgraded version of the old validateEmail function used to validate email addresses via SMTP and regex.
Categories : Email, Regexps, PHP
Display variables when a form is submitted using POST/GET
Categories : PHP, Functions, Variables, Debugging
 Sanjoy Roy wrote : 1291
I could not send mail using your code. I have changed the  Recipient email address to ensure it is going to my a/c but it is not doing anying. I hope it did not worked.

Hope to get your feedback soon.
 
 Boaz Yahav wrote :1292
I have noticed that some Anti Spam systems block these mails. are you using some kind of Anti Spam service?

Try to send to a Gmail address, even if it`s taken as spam, you will see it in the spam folder.

This code works for me.