This is an article from May, 2012 by a lawyer named John P Guidry II that explains the process:
http://www.orlandocriminaldefenseattorneyblog.com/2012/05/drug-trafficking-via-express-m.html
TL;DR: If they get enough suspicious indicators, they pull it from the regular mail stream, at which point if a dog hits, they contact a judge to get a warrant to open the package. More juicy details above in the link.
Federally, here is ENOUGH to get a warrant (maybe less required) from UNITED STATES v. HERNANDEZ (2002):
Phillips inspected the package and detained it for further investigation based on the following factors:
(1) his investigation of several databases revealed that the parcel had a correct return address, but the return addressee "Quiuirly Hernandez," could not be verified as living at that address;
(2) the express mail label was handwritten and sent person-to-person;
(3) the package was mailed from California, a known drug-source state;
(4) the package was almost completely taped on all seams; and
(5) the package was sent via express mail.
Due to the follow case, some of this dog procedure stuff might be changing in Oregon at least:
Suspicious indicators, from above:
They look for packages bearing exterior indicators that they deem characteristic of illegal-drug or drug-money parcels. Such indicators include the "overtaping" of a package's seams; handwritten, as opposed to printed, shipping information; delivery from an individual to an individual, rather than to or from a business entity; variation between the zip code from which a package was sent and the zip code listed for the return address; payment for delivery by cash or debit card, instead of billing to a business account; origination from a non-medical-marijuana state; waiver of any signature requirement at delivery; and use of possibly fictitious or incomplete identifying information for the sender or recipient.
I'll tell you whats a dead giveway. a priority envelope or box, with stamps, non internet paid postage. I used to work in a highrise and i think out of thousands of packages i only saw a handful with stamps on boxes.
so easy to provile like that. use itnernet paid postage and photoshop in an ebay/paypal logo and item # and your golden