email hyperlink allow user to choose email client - php

On some websites when I click the contact email link, I get either a list or some icons for common email programs like gmail, yahoo, hotmail, etc., and I can pick which email program I want to open, then the email program opens and fills in the To: and Subject: fields. I can't find any web pages to show as an example, but I have seen it sometimes with Craigslist. Does anybody know how to code for this?

You can populate subject and body - in most e-mail clients - like this:
E-mail
This is usually a far better solution than making the user pick their provider and relying on an undocumented and subject-to-change URL format of some sort, not to mention it works with desktop clients like Outlook.

viewing source on craigslist you can see the urls; this is gmails:
https://mail.google.com/mail/?view=cm&fs=1&to=TOADDRESS&su=SUBJECT&body=BODY&tf=1&shva=1
you want to check each sites documentation for the particulars

Related

How effectively send messages to a group of email addresses using a central address?

I have to set up an email sending solution, and I haven't yet figured out the best way to do this, I hope you have some ideas. I would like to achieve the following:
Have a central email address like mailinglist#mysite.com.
Behind this list there is a database of email addresses. I would like to be able to extend this list through an API. For example if a new user registers on my site, I want to add them to the list. Or if someone unsubscribes, I want to remove him from the list.
On my website I will place a button, and if the user clicks it their email client opens with the central address prepopulated.
If they send an email to this address, everyone will recieve it who is on the list.
If someone replies also everybody will recieve it.
(The application is written in PHP (Laravel framework) if that is important).
Do you know of any service where I can set up this kind of "mailing list", preferrably for free? (It would have a few hundred members, sending a somewhere around 30-100 emails a month.)
I guess you'll need root access to your (linux) webserver - then you can hook Sympa (read "list of features") into your MailTransportAgent (MTA) (postfix, exim) or whatever.

Email to trigger PHP Script... Possible?

I'm in need of setting up an auto-response from an email account that I control, based on trigger words within the body of the email. But also, it needs to add/delete rows from a database table based on trigger words sent to this email account (that belongs to my site) and it needs to create a topic, in some cases, within a forum, if sent to a different email address (but on the same server). I know PHP to be able to do this, but not really sure how to trigger a PHP script to be executed when an email gets sent to a specific email address account that I control. Or if there is another solution to accomplish this, please let me know.
This is basically an inquiry on how to accomplish something like this, based on an email sent to a specific email address on my server with words like: "Join", "Leave", "Set Mail", "Set Digest", etc. etc.
There will be another email address account set aside that will need to send those subscribers in the database, the same exact email (Mass Send). This is for a CDB-L ListServ. Kind of old school I suppose, but we want to transfer this ability to our server, since these old school methods still work today and is very much active.
Curious on security issues, what type of server software I'll need and just a basic approach on how to set something like this up.
You can alias your email address directly to a php script if you run your own mail server (on linux this would just be in the /etc/alias file or equivalent where the target was your php script instead of an email address) eg http://www.topwebhosts.org/bbs/board.php?bo_table=server_mgmt&wr_id=73
If not, then your only real choice is to set up a php process that checks an email address for mail every x minutes.
I have used both these methods over the years to great success
You can walk through emails with PHP's IMAP functions and undertake action (based on conditions/content). More info.

Can newsletter content be generated with PHP?

I manage a live music venue's newsletter and the show listings/calendar on the main site are generated using PHP. Is there a way to generate content in newsletters via php?
Example, I create the newsletter.php file, upload the code to our newsletter service provider, and when someone opens the message, the latest listings are available in their email.
As of now, I'm only seeing a portion of the php code where I'd like to see the calendar...
You can generate the content of an e-mail with any scripting language, but only before sending it. Once the e-mail has been sent, it has to be in a format that e-mail clients understand (such as plain text or HTML).
It's also very easy to send email with php, with the mail function.
You could generate the email from your php template, and if it looks how you want it to, click a button and send that email to the people on your mailing list.
It sounds like you have a newsletter-delivery service in place, but this is another option.

mailto: replacement due to size

I have a web page that generates several email addresses. I need to be able to click on a link, which will open an email client such as outlook and populate the bcc field with those email addresses. In the past, we have used html's mailto, which achieves this goal perfectly.
My problem now is that I need to send emails to over 200 people, and mailto cannot handle that much information. Since the page also uses PHP, I have considered PHP's mail() and phpmailer(), but since both require that the entire email be generated on the page and the email client is never opened, they will not work.
Does anybody know of an alternative method I can implement to achieve this functionality?
Create a mailing list, add those e-mails to the mailing-list and send mail there instead.
As a bonus, you can use VERP to prune invalid addresses.
I don't think there is a convenient alternative method.
You could offer a textarea field containing all the addresses in a comma-separated list. That list could be easily copy+pasted into the client's E-Mail program.
If the client's E-Mail is on the same domain as the web site, and you have full control over your server, you could randomly generate E-Mail addresses on your server using PHP:
1293820239453202349#example.com
that E-Mail address would be configured to forward incoming mail (that your user with the mail client writes and sends to that one random address) to the big list of recipients. This is a very advanced method but hard to implement.
Maybe you can make an email group, depending on your mail system, such that when you send a mail to the address of the group, it will distribute to all members?
On our company, we have several groups. all#company.com, sales#company.com, developers#company.com etc. Sending one e-mail to such an address will make all members of the respective group receiving it.
MailTo with a Copy
<a href="mailto:astark1#unl.edu?cc=ASTARK1#UNL.EDU">
MailTo with a Blind Copy
<a href="mailto:astark1#unl.edu?bcc=ASTARK1#UNL.EDU">

What is the best way to implement a petition? (email send after signing the petition)

I need to build a little webapp but I'm not sure what is the best thing to do.
A person that subscribe the petition is signing an email sent to X. This will be also saved to a db in order to show online who subscribed.
The idea is to have a standard text message, the user submit his name and that name goes into the message as signature.
I could make php send the email with the address of the real sender, or let the user copy and paste the text and let him send the email on his own.
I'm not sure of what is the best way to implement it. What will be more "effective", I mean as number of subscribers the solution where the app send the email is easier, but what about the authenticity of the emails? They could be considered not valid if sent all from the same place?
Regardless of the whole thing being a "good" idea or not, you want to keep yourself safe. If you spoof the from field, chances are most of your email (especially for domains with SPF records) will not make it through the first level of spam filtering.
A SPF (Sender Policy Framework) record lists the only IPs that are allowed to send mails for a domain. If a domain has a SPF record and you poll it, you're supposed to treat anything that didn't originate from a listed server as hazardous waste.
Depending on where you're sending these emails, you'll probably end up with your mail server on one or multiple blacklists. That means any email, SPF or not just won't get accepted.
So in short:
Get people to send their own email. Provide templates.
Consider utilizing the full specs for <a href="mailto:... -- you can put the subject and body in the link, allowing templates to be a one-click affair.
You could use Javascript on your site to personalise the message (and therefore mailto: link) while still on your site.
Let me get this straight - so you want to add to the flood of armchair activism email that is already saturating the world to no good purpose, and you're asking how best to do it? I would read the following before going any further with this:
http://www.breakthechain.org/armchair.html

Categories