API15

JMail/setSender: Difference between revisions

From Joomla! Documentation

m removing red link to edit, no existant pages
m preparing for archive only
 
Line 55: Line 55:


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=setSender
  category=setSender
  category=JMail
  category=JMail
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*

Latest revision as of 00:57, 25 March 2017

Description

Set the E-Mail sender

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

setSender($from)
Parameter Name Default Value Description
$from $from E-Mail address and Name of sender

Returns

void

Defined in

libraries/joomla/mail/mail.php

Importing

jimport( 'joomla.mail.mail' );

Source Body

function setSender($from)
{
        // If $from is an array we assume it has an address and a name
        if (is_array($from))
        {
                $this->From     = JMailHelper::cleanLine( $from[0] );
                $this->FromName = JMailHelper::cleanLine( $from[1] );
        // If it is a string we assume it is just the address
        } elseif (is_string($from)) {
                $this->From = JMailHelper::cleanLine( $from );
        // If it is neither, we throw a warning
        } else {
                JError::raiseWarning( 0, "JMail::  Invalid E-Mail Sender: $from", "JMail::setSender($from)");
        }
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

Code Examples