public abstract class EmailGateway

class.emailgateway.php #46

A base class for email gateways. All email-gateways should extend this class in order to work.

Methods

void __construct()

The constructor sets the _boundary_mixed and _boundary_alter variables to be unique hashes based off PHP's uniqid function.

void __destruct()
boolean|mixed __get(string $name)

Gets a property.

Magic function, supplied by php. This function will attempt to find a variable set with $name and returns it. If the variable is not set, it will return false.

Parameters
  • $name stringThe property name.

void|boolean __set(string $name, string $value)

Sets a property.

Magic function, supplied by php. This function will try and find a method of this class, by camelcasing the name, and appending it with set. If the function can not be found, an exception will be thrown.

Parameters
  • $name stringThe property name.

  • $value stringThe property value;

void appendHeaderField(string $name, string $body)

Appends a single header field to the header fields array. The header field should be presented as a name/body pair.

Parameters
  • $name stringThe header field name. Examples are From, X-Sender and Reply-to.

  • $body stringThe header field body.

void appendHeaderFields(array $header_array)

Appends one or more header fields to the header fields array. Header fields should be presented as an array with name/body pairs.

Parameters
  • $header_array arrayThe header fields. Examples are From, X-Sender and Reply-to.

boolean closeConnection()

Close the connection to the email Server. This function is used to allow persistent connections.

string contentInfoArray(mixed $type, mixed $file, mixed $filename)

Builds the right content-type/encoding types based on file and content-type.

Will return a string containing the section, or an empty array on failure. Can be used to send to an email server directly.

XMLElement getPreferencesPane()

The preferences to add to the preferences pane in the admin area.

boolean openConnection()

Open new connection to the email server. This function is used to allow persistent connections.

boolean send()

Sends the actual email. This function should be implemented in the Email Gateway itself and should return true or false if the email was successfully sent. See the default gateway for an example.

void setAttachments(string|array $file)
void setConfiguration(mixed $config, array $configuration)

Sets all configuration entries from an array. This enables extensions like the ENM to create email settings panes that work regardless of the email gateway. Every gateway should extend this method to add their own settings.

void setFrom(string $email, string $name)

Sets the sender-email and sender-name.

Parameters
  • $email stringThe email-address emails will be sent from.

  • $name stringThe name the emails will be sent from.

void setRecipients(string|array $email)

Sets the recipients.

Parameters
  • $email string|arrayThe email-address(es) to send the email to.

void setReplyToEmailAddress(string $email)

Sets the reply-to-email.

Parameters
  • $email stringThe email-address emails should be replied to.

void setReplyToName(string $name)

Sets the reply-to-name.

Parameters
  • $name stringThe name emails should be replied to.

void setSenderEmailAddress(string $email)

Sets the sender-email.

Parameters
  • $email stringThe email-address emails will be sent from.

void setSenderName(string $name)

Sets the sender-name.

Parameters
  • $name stringThe name emails will be sent from.

void setSubject(string $subject)

Sets the subject.

Parameters
  • $subject stringThe subject that the email will have.

void setTextEncoding(string $encoding)
Parameters
  • $encoding stringMust be either quoted-printable or base64.

void setTextHtml(string $text_html)

This functions takes a string to be used as the HTML content for the Email

void setTextPlain(string $text_plain)

This functions takes a string to be used as the plaintext content for the Email

boolean validate()

Makes sure the Subject, Sender Email and Recipients values are all set and are valid. The message body is checked in prepareMessageBody

See Also

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details