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
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
Mobile Dev World

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 : 4753
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>";
?>



Example of function to send out email if error occurs
Categories : PHP, Email, Debugging, Errors and Logging
An email validation script that actually checks against the recipient's mail server.
Categories : Email, Complete Programs, PHP, Network, Debugging
Class that allows the PHP developer to establish connections with a POP3 mail server amd be able to list, retrieve and delete mail messages from a given mail box.
Categories : Network, Email, PHP, PHP Classes
PHP based Contact email form with multiple recipients, text file based, supports departments.
Categories : PHP, Email, Beginner Guides, Filesystem
A Custom Error Handling And Debugging Class
Categories : PHP, PHP Classes, Debugging, Errors and Logging
PhpView 0.1 - simple php viewer, using temporary files and frames.
Categories : PHP, PHP Options and Info, Debugging, HTML and PHP
Alert in JavaScript and Trace in Flash Action script are two commands that I find very much useful for tracking and debugging errors in my scripts. Unfortunately, there is no such option in PHP.
Categories : PHP, Java Script, Debugging
PHPRecommend v1.0 - "Recommend this page to a friend" script written in PHP. Easy to install
Categories : PHP, URLs, Complete Programs, Email, Site Planning
Print structured array with offsets
Categories : PHP, Debugging, Arrays
imap_sort
Categories : IMAP, Email, PHP, PHP Functions
Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel
PHP port of Matt Wrights FormMail.pl WWW form to e-mail gateway.
Categories : Email, Complete Programs, Environment Variables, PHP
Save time debugging PHP3 under UNIX/Linux using linked .phps files
Categories : HTML and PHP, Debugging, PHP
PHPLinkRot v1.0 - program which allows users to report broken links on your website just by clicking a button. Works well on custom 404 pages
Categories : PHP, Complete Programs, Debugging, URLs, Site Planning
A time measuring and performance benchmarking class
Categories : PHP, PHP Classes, Testing, Debugging, Date Time
 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.