President Trump signed a mammoth opioids bill Wednesday designed to expand treatment options, fund nonaddictive painkillers and stop the flow of deadly synthetic drugs from abroad, calling it a critical piece of ongoing efforts to put a “big dent” in the crisis. The president offered handshakes all around after signing the bill in the ornate East Room of the White House, handing his pen to House Energy and Commerce Chairman Greg Walden, who steered the effort on his side of the Capitol. A bipartisan effort, the bill cleared both chambers by wide margins and offered a respite from partisan bickering over the Supreme Court and midterm contests. It also came hours after authorities intercepted mailed pipe bombs targeting CNN and past and present Democratic leaders. Mr. Trump told addiction survivors, law enforcement and other guests the bill capped “historic” efforts he’s taken in the last year to rein in the drug overdose epidemic, which killed a record 70,000 people in 2017. He cited indictments of Chinese nationals suspected of trafficking fentanyl, the launch of a Just Say No-style campaign against opioid use and a crackdown on doctors who wrote fraudulent prescriptions for opioids. And officials from a series of private companies, from Amazon to Facebook, shook hands with Mr. Trump while a narrator listed their efforts to combat addiction. “You won’t see the results immediately, but you’ll see the results in the future, and the very quick future,” Mr. Trump said. Dozens of lawmakers from both parties contributed to the legislative effort, which lifts cap on Medicaid funding for drug treatment, extends help to addicted mothers and empowers package inspectors to root out deadly fentanyl from China. Yet only one Democrat — Sen. Maggie Hassan of New Hampshire — was on hand for the signing, which comes less than two weeks before Election Day. A key part of the bill, the STOP Act, forces the U.S. Postal Service to collect advanced electronic data on packages entering the U.S. Private couriers such as UPS and FedEx already procure advanced data, which U.S. Customs and Border Protection uses to target suspicious packages that might contain fentanyl from clandestine labs in China and elsewhere. All packages from China, and 70 percent of the overall flow, must have the information available by the end of this year, and 100 percent global compliance is due by 2021. “This should cut down, almost immediately, the suspicious packages coming in from places like Mexico and China that contain illicit opioids like fentanyl,” White House Counselor Kellyanne Conway said. Officials say fentanyl has become the number-one killer in the drug-overdose crisis.