1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Want To Have Script That Generate Numbers And Send Email

Discussion in 'PHP' started by athar, Nov 13, 2007.

  1. #1
    Hello friends,

    if any one can help me in this regards.

    i want a php script that can generate numbers. i want 7 numbers to complete.

    if i give two numbers like 65 xxxxx it should start sending mail to , then plus one , then again + 1.
    so on to . after that it show me Completed text.
    and it should run unless 65 remails there. i mean it should not become 66.
    and after that i give again a two digit number like 66.


    So if any can help me. I can also pay for this too if you really have to work over it.
     
    athar, Nov 13, 2007 IP
  2. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #2
    
    <?php
    /**
     * @author Interviolet
     * @package -
     * @filename -
     * @copyright -
     */
    
    /**
    * Generate valid phone numbers
    * @param	int		start 
    * @access	private
    * <code><?php generate_numbers( 65 ); ?></code>
    **/
    function generate_numbers( $start )
    {
    	$number = sprintf( "%s00001", $start );
    	
    	while( substr( $number, 0, 2 ) != $start + 1 ) $numbers[ ] = $number++;
    	
    	return $numbers ;
    }
    /**
    * Generate email addresses from numbers
    * @param	int 	start
    * @param	string	provider
    * @access	private
    * <code><?php generate_emails( 65, "provider.com" ); ?></code>
    **/
    function generate_emails( $start, $provider )
    {
    	foreach( generate_numbers( $start ) as $number )
    	{
    		return sprintf( "%d@%s", $number, $provider );
    	}
    }
    /**
    * Send email to a shit load of numbers
    * @param	int		start
    * @param	string	provider
    * @param	string	subject
    * @param	string	email
    * @param	int		sleep
    * @access	public
    * <code><?php send_email( 65, "cellularone.com", "Subject of email", "Email message", 10 ); ?></code>
    **/
    function send_email( $start, $provider, $subject, $email, $sleep = 10 )
    {
    	foreach( generate_emails( $start, $provider ) as $address )
    	{
    		//mail( $address, $subject, $email );
    		//sleep( $sleep );
    	}
    }
    send_email( 65, "provider.com", "Subject of message", "Message itself" );
    ?>
    
    PHP:
    You need to finish the send_email function to send your mails ....
     
    krakjoe, Nov 13, 2007 IP
    athar likes this.
  3. athar

    athar Active Member

    Messages:
    258
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #3
    oh well joe , thanks alot

    you just helped me alot !

    rep added
     
    athar, Nov 13, 2007 IP
  4. athar

    athar Active Member

    Messages:
    258
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #4
    well one thing that , will it execute it self automaticaly till it ends to 99999 ?
     
    athar, Nov 13, 2007 IP
  5. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #5
    you need to at least uncomment the two lines mid mail function, and yes it will execute automatically as you requested .... I commented out the mail lines becuase you might want to send html or whatever, I assume you know how to use mail( ) .... you should also sleep( ) inbetween mails so as not to piss of your host/DC
     
    krakjoe, Nov 13, 2007 IP