Many Canadians were surprised this weekend when their phones were buzzed by an incoming spam text from an unexpected political source.

The Conservative Party of Canada mass-texted millions of randomly generated phone numbers in Saskatchewan, Manitoba, Ontario and New Brunswick, telling recipients that gasoline prices were about to spike and they should fill up. The texts were meant to drum up political opposition to the Trudeau government's carbon tax, which came into effect Monday in the four provinces that didn't come up with carbon pricing plans of their own.

The text messages linked to a different web address in each province. In each case, the link brought visitors to a web page that said that Conservative Leader Andrew Scheer plans to scrap the carbon tax if he becomes prime minister and invited visitors to enter personal information — such as email addresses and postal codes — if they also oppose the tax.

The web addresses included suffixes unique to each recipient, allowing them to be tracked when they clicked on the link.

In some cases, the message said it was coming from Scheer. In other instances, it was anonymous.

Some recipients took to Twitter to express their outrage over the unsolicited texts. Many said they thought the texts violated the law and they were complaining to the CRTC's Spam Reporting Centre.

I received an unsolicited text from Andrew Scheer.I didn’t give anyone associated with the CPC my phone number, there was no unsubscribe link in the text. This is in violation of the Canadian Anti-Spam Legislation (CASL). I’ve filed a complaint. <a href="https://t.co/agfJuW3LtL">pic.twitter.com/agfJuW3LtL</a> —@denavsworld

In fact, sending mass political texts is legal in Canada. And you'll "certainly" see more of them, said Cory Hann, director of communications for the Conservative Party of Canada.

But such messages do carry privacy and security risks. There may be ways to opt out of them as well.

Here are some answers to the questions Canadians are asking today about the texts.

If Canada has an anti-spam law, why are these mass texts allowed?

Canada's anti-spam law bans text messages that are commercial in nature unless the recipient has signed up to receive them. But the law does not cover "non-commercial" messages such as the ones sent out by Scheer's team over the weekend.

There are also exceptions made for messages sent by, or on behalf of, a political party or a candidate running for elected office.

If you have any concerns about a message you've received, you can still contact the Spam Reporting Centre.

Do the parties have to follow any rules on mass-texting?

Not really, said Tamir Israel, staff lawyer for the Canadian Internet Policy and Public Interest Clinic at the University of Ottawa, which studies public policy issues related to law and technology.

"Political parties are in basically a regulatory black hole," Israel said. "There's just very little that's limiting or even regulating their ability to do what they want to do, in terms of both collection and profiling of citizens as well as ... messaging."

Robocalls are restricted to certain times of day; callers must state who they are and who they're calling on behalf of, and they must give recipients a chance to opt out of such calls. No such rules exist for political text messages. (Rachel Bergen/CBC News)

The one exception is automated phone dialling operations, or "robocalls." Those are restricted to certain times of day; callers must state who they are and on whose behalf they're calling, and they must give recipients a chance to opt out of such calls.

No such rules exist for political text messages.

"We just haven't extended that regime to other types of communication mediums," Israel said, "even ones being increasingly used by everybody."

What information can political parties collect through these texts?

If you text back or click on the link, the sender knows that you received and read the message and that your number corresponds to a real phone. Your number and area code also provide some location information.

Once you click through the link, which is unique to you, your phone number can be linked to a profile of you, Israel said. It may show what parts of the web page you clicked through to — and it may place a file called a "cookie" on your browser showing which other sites you visited, until you "clear" or erase those cookies in your browser's privacy settings.

The Conservative website's own privacy policy says that "non-personal information may be collected by the Conservative Party through the use of cookies, including third-party cookies."

Alex Marland, a political science professor who studies political marketing at Memorial University, said such unique web addresses also are used to help parties decide which versions of a text message earn more clicks.

This is a version of the mass text message from the Conservative Party received by people in Ontario; it didn't include an organization or the name of the sender. Note the random letters at the end of the web address that help to track the recipient. (CBC News)

Hann was asked why some versions of the message didn't include Scheer's name or that of his party. "It was just a matter of having a variety of different messages, to see what worked," he said.

If, after having clicked through the text message, you actually enter your personal information on the website, the Conservative Party's privacy policy says that you consent to being added to the party's email list.

Are there any other risks involved in clicking through a link like that?

Yes. That's why we got an anti-spam law in the first place, Israel said. "Unsolicited communications in general in both text and email continues to be one of the prime delivery vehicles for malware," he said.

Such malware includes software that locks your computer and makes it unusable until you pay a ransom, and is often designed to be installed the minute you load a page.

Hann said the Conservative's Party's websites are "completely secure." But malware is often installed on the pages of unsuspecting organizations.

And there's no guarantee that a text message was actually sent by the person it claims to be coming from (trolls seeking to influence elections have been a problem in the recent past). In any case, some of the Conservative Party's own text messages were anonymous.

Israel suggests that if you really want to see the information in a link received in an unsolicited text, the safest thing is to Google-search for it in an incognito browser. (Just remember to exclude the random letters at the end of the address that are used for tracking purposes.)

I just got one of these texts. How do I avoid getting more?

Unfortunately, blocking the number probably won't work because the messages are sent from multiple phone numbers using a computer, and it's likely they'll come from a different number next time.

Israel suggested contacting the candidate or party who sent them. Even though they're not required to remove you from their list, they might.

He said that texting back might be the safest way to make contact with the sender, as you're less likely to pick up malware that way than by clicking on a link. (However, in doing so, you confirm your number is real, and there's the risk you could get it added to a spam list.)

Hann recommended texting back the word "unsubscribe" or "stop." Or calling the Conservative Party of Canada.

At least some recipients of the text message reported their replies were "not delivered." Hann said that as of Monday afternoon, all numbers that the party texted from are "live" and capable of receiving replies.

Am I likely to get more of these?

Very likely — even if you're in a province that didn't get this weekend's texts, or you managed to opt out of the Conservative Party's list.

Hann said this was the party's first text messaging campaign of this size.

"It looks to be a success," he said. When asked if the party would do it again, he said, "Certainly, yeah. It's six months to an election. Canadians can expect to hear from the Conservative Party."

Memorial University's Alex Marland said the CPC probably won't be the only federal party cold-texting Canadians in the run-up to the October election.

"It's inevitable that all parties will be doing it," he said. "It's not a question of if — it's when."

Such text campaigns offer parties a convenient type of "stealth marketing," he said, since opponents can't see and rebut the messages. It's inexpensive, too, and it allows you to precisely target specific voters with tailored messages — something Israel said he also expects to see the parties doing soon.

But Marland said Canadians shouldn't assume that's a bad thing. For starters, it's simply a technological extension of what political parties have been doing for a very long time with email, phones, letters and door-knocking.

"(And) if we believe in a civil society where people are increasingly bombarded with all sorts of messages, isn't it important to make sure that citizens have information?" he said.

What's important, he said, is to make sure this tool is used to spread information, rather than personal attacks on political opponents.

Israel said he'd like to see political messaging brought into a regulatory regime similar to the one for robocalls.

"I don't think we can afford to exempt political messaging from the protections we have for other types of electronic messaging."

He added that some jurisdictions, such as B.C. and the United Kingdom, do have laws restricting political text messages that address their effects on voter privacy, disclosure of the sender's identity and the recipient's ability to opt out.

"More than anything, that shows you can have modern day campaigns with these rules in place."