Archive for the 'Email & Spam' Category

PEAR::Mail leaving the To field blank

Monday, November 7th, 2005

Update: As mentioned, i was trying to get a php mass mailing script working. It seemed to be working well in the first little test except that it was leaving the "To:" field blank.
 
After a lot of searching which threw up no answers I started looking at disabling parts of the programme starting with the sending of html and other multipart mime mails (try saying that after a good night out). As soon as I´d done this it all started working fine. As soon as I enabled it again it stopped working again.
 
After doing some messing with headers from Outlook generated emails and a few others I found out it was because I was setting the "To" header last, after the Mime version and content type. To get it working properly you just need to set the "To" header before the others. This gets it showing up in mail clients the way it should.

 
Time for the next series of tests…

PHP Mass Mailing Solution

Friday, November 4th, 2005

I mentioned before that I was having problems with a mailing script to a large number of recipients. I´ve been looking around for a solution so that I get some mailings done without making everyone mad by getting a dozen or so copies of the email.
 
After searching around for a while I was reading the PHP manual page for the mail() function and read the bit that says "don´t use the mail() function for mass mailing". Apparently it opens a new connection to the server for time it is called and if used in a loop for a large number of people, it can obviously cause problems. The solution it suggests is to use the PEAR::Mail functions that are built into the PHP download as default.

 
I´ve now modified the script to use this and am running a few tests on my own mailboxes with about 12,000 made up addresses. The other advantage of it is that it lets you use and authenticate with any SMTP server so I can use our webhost instead of my poor little overloaded mail server in the office. I´ll post again when I know if it´ll work or not.

Stupid PHP mail function and mass mailing

Monday, October 31st, 2005

We´ve just done a mailing out to 13,000 receipients using a custom php script I wrote that goes and gets a bunch of email addresses from the database and then loops through them and calls the php mail() function. It all seemed to be working well until we started getting feedback from some of the people on the list saying that they were getting up to 11 copies of the email.

 
This seemed very strange since I´ve used this script many times without any problems so I decided to get down to the root of the problem. Luckily I had put in some error checking so I went to the database to see what was going on. Long story short, the php bit was only being run once for each email address, including the mail function. For some reason though, sendmail was pushing out more than one copy of the message.
 
I decided to hit google and see what I could find out there before I started messing around with scripts and testing different server configurations. After a bit of searching I found out that nobody really knows what might be causing it. Some reckon it´s sendmail pushing up the server load, some reckon it´s php´s mail function not receiving "true" variables from sendmail.
 
Either way, since there´s no definate answer I´m going to start running some tests and see what I can come up with myself.

Gmail is spam?

Monday, October 31st, 2005

Well, No. As an internet company I think Google rates as my "Most Trusted" so I doubt that there would be spam coming from a valid Gmail account.
 
There is the other point that the email that got shoved into my Outlook Junk Email folder was from me! It was a quick mail I sent myself before I left for work and if I hadn´t decided to have a quick browse of the junk while I was waiting for something to burn then I never would have got it.
 
True, the stuff in the email was "gibberish" (stuff about 302 ErrorDocument rewrites…), but it was still a valid email. Oh well.

A new type os spam: Splogging

Tuesday, October 25th, 2005

There´s a new type of spam I was reading about on Slashdot today called Splogging. I´d actually come across this before when I was doing some random Googling when I was bored. The ones I came across were obviously for porn sites since they are always after getting more traffic.
 
The way splogging works is that they automatically create a load of blogs on a free blogging service (in this case it was Blogger) filled with keyword loaded but essentially gibberish sentences and then link back to the main site.
 
This is a bit of a pain in the arse as far as contaminating the serps goes and the various services like Blogger are working on getting the problem fixed. The thing I don´t really get is why they´re doing it in the first place. It´s obviously an attempt to get a higher PageRank but the sites they are linking from all have PR0 so if the formulas in google´s algorithm are what they say they are, then it shouldn´t have much of an effect.
 

Anyway, enough talk of PageRank, I´m going to watch Lost instead

Cool automated mailing program

Monday, October 24th, 2005

We´ve done mailings before using PHP scripts that I´ve written (not spam, just large automatic newsletters) which have been sent out overnight by our own mail server. The problem is that I have to spend an hour or so creating the code for the message.
 
Since we want to start doing more of these now, I decided to come up with a more automated system so there´s less for me to do (always a bonus). After a days programming we now have a system that does it all! The first stage is a form where we can fill in a subject line and choose the email contact list to send the email to. This generates a mailto link that creates a new message that has the address for the mailing programme filled in along with a custom subject line that identifies the group as well as the subject.
 
The programme then checks this mailbox every night and if there´s a new message it automatically sends out the message to that group. It also adds code to put an image on the page and sends a copy to another mailbox of ours. The second email account is then checked and if the copy of the message is there, that email is verified as "sent". The image is used to verify the message has been opened. The path to the image on our server has the users email address encoded into it. When the email client requests the image, a php script is run through the old 404 ErrorDocument method and updates the database that that user has read it. It then sends that actual image to the client.
 

This way the others in the office can do large automated mailings to different groups and track the progress of them without involving me at all.

Image Verification and Comment Spam

Wednesday, September 14th, 2005

This blog and a few others that people I know use are run off php scripts that I wrote. Instead of an all-singing all-dancing set of scritps I´ve generally just added bits to it when it´s been needed.

 
The latest problem we´ve had is comment spam. I haven´t bothered to track down who it was but the content was always MIME code (the stuff emails are made up of) which doesn´t really make sense since most comment spam is used to boost a sites serps. I have finally got around to sorting it out though.
 
Now all the post´s comment forms have one of those images where you have to enter the string of characters into the box to enter a comment. It´s all done by through php which randomly generates a string of characters, creates an image with the string in it, outputs the image to the browser and then destroys it. It also stores the string in a session variable and then when someone submits a comment it checks that what they´ve entered to see if it matches what is stored in the session. If not it outputs an error message. Job done.
 
Now lets see how long it is until some bored script kiddie reads this and tries to hack it!

Reducing the amount of spam I get

Monday, June 6th, 2005

I´ve decided I´m going to try and get rid of some more spam before it gets to my inbox. Considering what I do for a living I don´t really get that much spam coming in since one of my two main email addresses is filtered on the mail server. The Outlook spam filter handles a fair amount of other stuff but I still get about 30% of my inbox consisting of junk.
 
Most of the spam is coming in to a catch all address on a domain I´ve had for the longest but since it´s mine and pointed at my server which I have full root access. This means I can do whatever I want with it as far as spam tools go. The server is a good old Linux box with Sendmail and Postfix installed to handle my email requirements so I think I´m gonna start by shoving Spamassassin on it as well. This should hopefully kill a few more junk mails and if not, keep a load of them from my desktop machine anyway.

 
I´m also going to blacklist a range of IP addresses that belong to some foreign countries since I don´t need to communicate with them and they are known to be sources of spam. All I need to do then is convince everyone in the world to install an Antivirus program so their PCs don´t become zombies and start sending me loads of junk.

Mailing list email being received?

Friday, March 25th, 2005

One of our clients that does interior design asked me to do a mailing list for them. Not a problem. We have done a lot of leg-work to make sure that we can code an email that gets past most spam filters out there (since this is both targeted and subscribed to, its not spam anyway - just automated).
 
Only problem was to get some way to track if people were actually reading the things, or even receiving them at all! Since read receipts are an iffy one since they are optional, we decided to do something server side to check it. As it is database driven the code can be altered for each email that gets sent out and therefore the simplest way is to include an image (such as the company logo) with the path altered to include the ID of the email address from the database.

 
Since there isn´t an image there on the server, Apache and htaccess will handle the 404 error and direct it to a PHP file. This will then take the ID from the requested URL and then update the database to say that email has been read. It will then stream the requested image out to the email client. Ah, Apache and .htaccess, if I could I would run away with you both and live on a mountain side in peace.
 
Not a bad idea though, time to see if it´ll actually work…

Stupid free email accounts

Friday, March 11th, 2005

So we have a simple login system for our automated reminder system which asks for various details such as name, address, mobile number and lastly, email address.  The email address is quite important as this is a purely online system and so most communication is done through email (such as notifications, billing reminders, special offers, etc).

 
Upon registration an email is sent out confirming the new users email address and password.  Lately I´ve been getting messages rebounded from some of the various free email providers such as Hotmail.  Chances are this is because the user hasn´t checked their account in the last month, as opposed to a false address (since they are along the lines of some_random_string_of_crap74@hotmail.com).
 
I originally didn´t want to use email verification methods as it makes it a more complicated registration process and as it´s a paid for service, I expected users to be responsible with the information they gave.  On second thoughts I´ve decided to implement a verification process where the user is logged in when they click on a link in an email they receive to an address they specify.  This must be done within a certain time which is stored in the database.  This means that anyone not verifying will have their account disabled.

 
The downside to this is that legitimate users would suffer a delay before they can use their account, so I decided to give them a 24 hour grace period, then log them out and disable their account if they haven´t verified by this time. Hopefully it´ll give a more robust system.