Friday, March 19th, 2010 (updated 26 Jan ’12)

Documentation for Send Email v1.4

 

The Send Email plugin lets you send an email from within an ExpressionEngine template without the user submitting a form.

Compatibility

Compatible with both EE v1.x and v2.x.

Installation

EE v1.x

Place the pi.send_email.php file in the /plugins directory.

EE v2.x

Create in the /third_party directory a directory /send_email, then place the pi.send_email.php in there.

Required Parameters

to

This is the only required parameter, the email address that the email will go to.

Optional Parameters

from_email

The email address that will appear in the email’s From area. If using, also requires the from_name parameter.

from_name

The name address that will appear in the email’s From area. If using, also requires the from_email parameter.

subject

The email’s subject. If left empty, the default is “Email from [site_name]”.

mailtype

Either “html” or “plain”. Default is “plain”. Currently working in EE v2.x only.

parse

This parameter is available to all EE plugins. When set with a value of “inward” it allows the plugin to contain other plugins.

Variables

username, screen_name, member_id, email, ip_address

Example

{exp:send_email 
    from_name
="Joe Kissel" 
    
from_email="joe@kisselmail.org" 
    
to="mail@wackysillyhairpieces.net" 
    
subject="Hairpiece for Pico"
}
Dear Wacky Silly Hairpieces
,

Can you do something about {screen_name}s hairThough he does got to get back to work.

Thank you,

Joe Kissel
{
/exp:send_email} 

Thu 15 Apr ’10
1:21pm

Sophia Browne

Does this plugin allow dynamic variables?  I am trying to use {site_name} and {webmaster_email} and they are not being processed.

Thu 15 Apr ’10
2:54pm

Adam Khan

Sophia, try parse=“inward”. If that doesn’t work, I’ll have to work on it to get variables working.

Thu 15 Apr ’10
9:14pm

Sophia Browne

Hi, I tried the parse=inward and that didn’t work either.

Fri 16 Apr ’10
8:30pm

Adam Khan

Sophia, thanks for trying. I’ve added that to the plugin’s roadmap. Can’t say with confidence when exactly I’ll get to it though.

Fri 16 Apr ’10
11:14pm

Sophia Browne

Ok, that’s no problem.  I will just workaround it.

Thanks anyways.

Tue 20 Apr ’10
10:27pm

Kurt

I’m very interested in this. I’ve been asked to create a sort of tell-a-friend/e-card that self submits after a freeform is submitted. This might be a great way to make that happen.

Tue 4 May ’10
5:45pm

Nick Benson

I’m getting the following error on my EE 2 site, any thoughts?

————————-

A PHP Error was encountered

Severity: Notice

Message: Use of undefined constant PATH_CORE - assumed ‘PATH_CORE’

Filename: send_email/pi.send_email.php

Line Number: 74

Sun 11 Jul ’10
1:56am

jimboJ

Any news following on from Nick Benson’s comment above? Having the same issue…

Tue 10 Aug ’10
8:50pm

Kyle Batson

I have a request that allows using conditionals inside the message. I’m populating the message field with some custom fields, and if that custom field is not present, I don’t want it to show up. Something simple like {if custom_field}Content here{/if}

Also, might you know why having ‘http://’ in the message field outputs as encoded HTML character entities instead? Is there a way this can be switched from within the plugin?

Thanks.

Wed 25 Aug ’10
6:08am

Adam Khan

Sorry for not responding, people, I’ve been a bit swamped and haven’t had time to address issues on the free plugins.

Nick and JimboJ, I haven’t yet figured out why the PHP notice is happening, sorry!

Kyle, the encoding is happening within EE’s built-in functions that the plugin’s calling—I’ll have to look further to see how to disable that.

Wed 29 Sep ’10
2:42pm

Sophia Browne

Hi,

I added to the send email plugin since I had the same HTML character entities problem.
I added a function from the Regular expressions class to the -> $E->message($REGX->unhtmlentities($message));  Don’t forget to call the class -> global $REGX; // EEv1 syntax.

The unhtmlentities function takes a string and returns with all entities turned into their characters. http://expressionengine.com/legacy_docs/development/reference/regex.html

In a bit of a hurry, so I have to keep this short, hope this helps!

Mon 10 Jan ’11
12:38pm

Adam Khan

Sophie, it’s months later, my apologies for leaving you in the lurch there, presume you got it fixed!

Mon 10 Jan ’11
5:13pm

Sophia Pitt-Browne

Yes Adam, I did!

Thu 17 Mar ’11
6:51am

Stuart

Re: Use of undefined constant PATH_CORE

Looking at the file and the structure of 1.6 V 2.0.1 that the file it’s referencing “core.email” no longer exists in 2.1.X

No idea how to amend or what to amend to :(

Fri 22 Apr ’11
1:41pm

James

I’m getting the same PHP error as Nick, did anyone ever find a way round it?

Tue 24 May ’11
3:11pm

Jim

Any idea when yo might add the functionality for variables?

Tue 2 Aug ’11
3:34pm

Tiffany

I got this to work on EE 2.1.3 by replacing the send email code with this:

        // Send email
        $this->EE->load->library(‘email’);
        $this->EE->email->initialize();
        if ($from_email && $from_name)
        {
          $this->EE->email->from($from_email, $from_name);
        }
        else
        {
          $this->EE->email->from($PREFS->ini(‘webmaster_email’), $PREFS->ini(‘webmaster_name’));
        }
        $this->EE->email->to($to);
        if ($subject)
        {
          $this->EE->email->subject($subject);
        }
        else
        {
          $this->EE->email->subject( “Email from ” . $PREFS->ini(‘site_name’) );
        }
        $this->EE->email->message($message);
        $this->EE->email->Send();

Mon 23 Jan ’12
10:43pm

Adam Khan

Tiffany, a very belated thanks for fixing the plugin. Working for me on EE2. Not sure now though on EE1, will have to check.

Wed 7 Mar ’12
8:33pm

Toby Callinan

Just wondering…

Does this plugin work when it’s submit? It mentions that it works without submitting a form. Does that mean I can set up a cron job that will then just send an email?

I’m tring to find a method to send emails after a query I the DB that pulls out certain users - ths might be perfect!

Wed 7 Mar ’12
8:39pm

Adam Khan

Toby,

No form involved, just sends an email when the template containing the tag is loaded. Nice when loaded with ajax.

Tue 10 Apr ’12
3:32pm

Rob Stokes

If I understand correctly ... the from name, from email address, to email address and subject all have to be hard-coded into the template. It is not possible, for example, to look at a channel entry and pull out the details from there?

I was hoping to use this plug-in to send a “thank you” notification email to a user after they had filled in a form (with which I am using Safecracker to store the entered details in a channel) on the site. The “to” email address at the very least will be dynamic.

Can I not do this with this plug-in?

Tue 10 Apr ’12
3:42pm

Rob Stokes

Thought I’d better say ... I’ve tried putting the {exp:channel:entries} code directly within the send_email tag, as well as calling the result via a snippet and an embed, but none worked. Works fine when I hard-code the details.

Fri 11 May ’12
3:22pm

Michael Rog

Rob, try wrapping the Send_email plugin INSIDE of the Channel:Entries tag, and use parse=“inward” on the outer tag. Then you can use the email address variables from your entries as the parameters of Send_email.

Thu 21 Jun ’12
5:47pm

Laurence Cope

This is a great little plugin. I am combining it with EEI_TCPDF to generate a PDF from a template then saves it, and uses Send Email to attach and email it.

So I have modified your file to add attach, I think you should update it, its very useful…


$attachment = $TMPL->fetch_param(‘attachment’);
       
// Attach attachment
if($attachment != ‘’)
{
  $this->EE->email->attach($attachment);
}

Fri 22 Jun ’12
12:52pm

Adam Khan

Thanks Laurence, will add that in for next release!

Fri 28 Sep ’12
4:30am

Craig Allen

I’ve tried it with mailtype=“html”, but all the html is being displayed in email clients. What might be the cause of this? I’m using EE 2.5.2

Thu 26 Jun ’14
3:31pm

Jamie Blacker

It says that the mailtype parameter was added in 2010, but it doesn’t seem to be in V1.4.
To add it in:
$mailtype = $TMPL->fetch_param(‘mailtype’);
if ($mailtype == “html”)
{
$this->EE->email->mailtype = ‘html’;
}

Mon 26 Nov ’18
2:55pm

John

Thank you for this information. I really appreciate you sharing all of these. concrete contractors tuscaloosa al

Sat 22 Dec ’18
5:37am

Softech

Wonderful presentation.This presentation help to gather more information.
Thank You for sharing.

Sat 22 Dec ’18
5:55am

Michel Foster

Wonderful presentation grate article which is help to gather more information.
Thank You for sharing.

Fri 28 Dec ’18
3:22am

Jonathon Coleman

Awesome information I am reading here.
Jon of columbia heating and cooling

Sat 12 Jan ’19
2:31am

Na ta

Thank you for sharing this exciting resource with me and the world. Wish you always luck.
Douchebag Workout

Mon 21 Jan ’19
8:19am

Alex Jacob

Thank you for that PlugIn
Check out deer hunting games free.

Post a comment

Name:

Email:

Location:

URL:

Your comment:

Please answer the following question to assure your intentions are honorable: What is the capital of France? (5 characters required)

Remember my personal information
Notify me of follow-up comments?