Whilst working on a current project I was trying to get cross-browser compatability working nicely. However when I came to load up IE’s Developer Tools I found it was loading up the window but nothing was there! I’m running Windows 7 and this seems to be the only Continue reading
Monthly Archives: November 2009
Email to SMS / Email to Mobile, Free Database
Heres another one of my general snippets in part of coding a new project. This database has been created solely using data from Wikipedia. I’ve edited the list, removed those which are either commercial, don’t provide actual email addresses or those that I can visibly see don’t work. The list on Wikipedia may be slightly out of date so let me know if any carriers have changed/updated their system.
The database is in CSV format. To download, “right click -> save link as… ” as the link below and remove the “_.txt”. You can then import into MySQL or whatever.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | Carrier,Region,Email,Message Format Aircel,"[18 circles], India",number@aircel.co.in,text Airtel,"Andhra Pradesh, India",number@airtelap.com,text Airtel,"Karnataka, India",number@airtelkkk.com,text Alaska Communications Systems,USA,number@msg.acsalaska.net,text Alltel Wireless (presently merging with Verizon Wireless),USA,number@message.Alltel.com,text Alltel Wireless Alternative,USA,number@text.wireless.alltel.com,text AT&T Wireless,USA,number@txt.att.net,emailaddress text Older AT&T Wireless,USA,number@mmode.com,emailaddress text AT&T Mobility (formerly Cingular),USA,number@txt.att.net ,text Cingular (Now AT&T),USA,number@cingularme.com,text AT&T Enterprise Paging,USA,number@page.att.net,text Bell Mobility & Solo Mobile,Canada,number@txt.bell.ca,text Bell Mobility Alternative,Canada,number@txt.bellmobility.ca,text Boost Mobile,USA,number@boostmobile.com,text Bouygues Télécom,France,number@mms.bouyguestelecom.fr,text Loop (BPL Mobile),"Mumbai, India",number@bplmobile.com,text Cellular One (Dobson),USA,number@mobile.celloneusa.com,text Cingular (Postpaid),USA,number@cingular.com,text Centennial Wireless,"USA, Puerto Rico, and the U.S. Virgin Islands",number@cwemail.com,text Cincinnati Bell,USA,number@gocbw.com,text Cingular (GoPhone prepaid),USA,number@cingulartext.com,text Claro (Brasil),Brasil,number@clarotorpedo.com.br,text Claro (Nicaragua),Nicaragua,number@ideasclaro-ca.com,text Comcel,Colombia,number@comcel.com.co,text Cricket,,number@sms.mycricket.com,text CTI Móvil (Now Claro),Argentina,number@sms.ctimovil.com.ar,text Emtel,Mauritius,number@emtelworld.net,text Fido,Canada,number@fido.ca,text General Communications Inc.,Alaska,number@mobile.gci.net,text Globalstar (satellite),,number@msg.globalstarusa.com,text Helio,,number@myhelio.com,text Iridium,,number@msg.iridium.com[6],text i wireless (T-Mobile),,number.iws@iwspcs.net,text i-wireless (Sprint PCS),,number@iwirelesshometext.com,text Koodo Mobile,Canada,number@msg.telus.com,text Mero Mobile,Nepal,+977number@sms.spicenepal.com,text MetroPCS,,number@mymetropcs.com,text Movicom,,number@movimensaje.com.ar,text Mobitel,Sri Lanka,number@sms.mobitel.lk,text Movistar,Colombia,number@movistar.com.co,text MTN,South Africa,number@sms.co.za,text MTS Mobility,Canada,number@text.mtsmobility.com,text Nextel ,United States,number@messaging.nextel.com,text Nextel,México,number@msgnextel.com.mx,text Nextel,Argentina,number@nextel.net.ar,text Orange Polska,Poland,number@orange.pl,text Plus,Poland,+48number@text.plusgsm.pl,text PC Telecom,Canada,number@mobiletxt.ca,text Qwest Wireless,USA,number@qwestmp.com,text Rogers Wireless,Canada,number@pcs.rogers.com,text SaskTel,Canada,number@sms.sasktel.com,text Setar Mobile,Aruba,+297number@mas.aw,text Sprint (PCS),USA,number@messaging.sprintpcs.com,text Sprint (Nextel),USA,number@page.nextel.com,text Suncom,,number@tms.suncom.com,text Sunrise Communications,Switzerland,number@gsm.sunrise.ch,text Syringa Wireless,USA,number@rinasms.com,text T-Mobile,USA,+1number@tmomail.net,text T-Mobile,Austria,number@sms.t-mobile.at,text T-Mobile,Croatia,+385number@sms.t-mobile.hr,emailaddress##subject#text Telus Mobility,Canada,number@msg.telus.com,text Tigo (Formerly Ola),Colombia,number@sms.tigo.com.co,text Tracfone (prepaid),,number@mmst5.tracfone.com,text Unicel,USA,number@utext.com,text US Cellular,USA,number@email.uscc.net,text Verizon,USA,number@vtext.com,text Viaero,USA,number@viaerosms.com,text Virgin Mobile,Canada,number@vmobile.ca,text Virgin Mobile,USA,number@vmobl.com,text |
MultiPart E-Mail Code for PHP (Text and HTML)
Whilst trawling through some of my ultra-old posts on various forums I’ve found this nifty little piece of code that enables you to send in both HTML and TEXT form. This is useful for clients that cant display HTML (they will display the text instead). I developed it back in 2007 so it may need updating but its a useful bit of code!
UPDATE: Peter Mills recently emailed me with a problem with this script and compatability with gmail, I have managed to fix this. It seems that gmails parser has gotten even more strict, there were stray line breaks where there shouldnt have been and the initial boundary declaration in the headers was not wrapped properly in double quotes! Cheers for finding this bug Peter and hopefully its all working again now!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | <?php /* Sam Cleaver aka Beaver6813 (http://www.beaver6813.com) Mutlipart Email Script, Sends In Both Plain And HTML For Compatibility Which Works With MIME 1.0+ Supporting Software. Email: samcleaver.beaver[-at]gmail[-dot]com Copyright (C) 2007 Beaver6813 Updated November 2009. Thanks to Peter Mills for his help in recognising the recent problem the script had with GMail! -------------------------------------------------------------- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -------------------------------------------------------------- */ /* CHANGES: -- Is Now Compatible With GMail -- Encrypts Messages In Base64 For Easier Transportation -- 03/11/09 - Changed to work with changes in GMail, removed now unnecessary base64 encoding NOTES: -- From experience with different mail services i've discovered some key pointers when sending html or any type of email: * DO NOT link to external CSS stylesheets, most of the time these are either filtered out or do not load properly * As discovered in GMail it strips out any stylesheets completely, even inline ones so you're going to have to use the style='' tags on any div's etc you want to make look pretty * Bear in mind linking to any external resources will bring up a warning on the clients end and they can choose to or not to load external resources. * Keep HTML resources as simple as possible, most of the time they aren't loaded as well as they would in firefox and so can be really mucked up if you do some complicated magic with them. COMING SOON: -- Will be turned into a class making it easier to send emails :) */ # Is the OS Windows or Mac or Linux if (strtoupper(substr(PHP_OS,0,3)=='WIN')) { $eol="\r\n"; } elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) { $eol="\r"; } else { $eol="\n"; } $_emailer_subject = "My First Email Yay!"; //The subject of the email... duh $_emailer_to = "sam@beaver6813.com"; //You can make this even easier for the //email client by specifying the actual name of the person as well, but for //simplicities sake we'll just give the email $_emailer_from = "test@localhost"; //Again, you can do to this what //i said above $_emailer_reply_to = "test@localhost"; $_emailer_cc = ''; //Optional $_emailer_bcc = '';//Optional //Okay what do you want to appear if it displays the plain text version? $email_html = "<h1>HTML E-mail</h1> <p>This is an <b>HTML</b> e-mail.</p>"; //Okay what do you want to appear if it displays the HTML version? $email_plain = "HTML E-mail\n\nThis is the text portion of an HTML e-mail\n"; /* YOU NEED CONFIGURE NOTHING MORE!!!! (Apart from the respond at the very bottom of this script!) */ $_emailer_subject = $_emailer_subject == '' ? 'No Subject' : $_emailer_subject; // Must have a subject if(!empty($_emailer_cc)) $_emailer_cc_do = "Cc: ".substr( $_emailer_cc , 0 , -2 ).$eol; // Remove the trailing ", " if(!empty($_emailer_bcc)) $_emailer_bcc_do = "Bcc: ".substr( $_emailer_bcc , 0 , -2 ).$eol; $_emailer_reply_to = $_emailer_reply_to == '' ? $_emailer_from : $_emailer_reply_to; $mid = md5( uniqid( time() ) ); // Generate a unique id for the email $host = str_replace( 'www' , '' , $_SERVER['HTTP_HOST'] ); // Remove the www for an "email address" //add From: header $headers = "From: $_emailer_from$eol"; //specify MIME version 1.0 $headers .= "Return-Path: $_emailer_reply_to$eol"; $headers .= "$_emailer_cc_do"; $headers .= "$_emailer_bcc_do"; $headers .= "MIME-Version: 1.0$eol"; $headers .= "Message-ID: <$mid@$host>$eol"; $headers .= "X-Priority: 3$eol"; $headers .= "X-MSMail-Priority: Normal$eol"; $headers .= "X-Mailer: PHP$eol"; $headers .= "X-MimeOLE: Generated By Beaver6813s MultiPart Mail Script$eol"; $headers .= "Date: " . gmdate('D, d M Y H:i:s Z' , time() ) . $eol; //unique boundary this can be whatever you want... but try and make it imaginative :) $boundary = uniqid("BEAVER6813"); //tell e-mail client this e-mail contains//alternate versions $headers .= "Content-type: multipart/alternative; boundary=\"$boundary\"".$eol.$eol; //plain text version of message $body = "--$boundary".$eol."Content-Type: text/plain; charset=\"iso-8859-1\"".$eol."Content-transfer-encoding: 8bit".$eol.$eol; $body .= chunk_split("$email_plain").$eol.$eol; //HTML version of message $body .= "--$boundary".$eol."Content-Type: text/html; charset=\"iso-8859-1\"".$eol."Content-Transfer-Encoding: quoted-printable".$eol.$eol; $body .= chunk_split("$email_html").$eol.$eol; # Finished $body .= "--$boundary--".$eol.$eol; // finish with two eol's for better security. //send message $result = mail($_emailer_to, $_emailer_subject, $body, $headers); if($result) { echo "MAIL SENT SUCCESSFULLY. YOU'RE A WINNER!"; } else { echo "SOME WEIRD ERROR :S. YOU LOSE"; } ?> |