The PMPro Email object in Paid Memberships Pro is used for managing and sending emails within the PMPro system. It includes a variety of properties and methods that allow for customization and control over the email sending process.
- Type: String
- Description: The email address of the recipient.
- Type: String
- Description: The name of the email template being used.
- Type: String
- Description: The subject line of the email.
- Type: String
- Description: The body content of the email.
- Type: Array/String
- Description: Additional headers for the email, like content type.
- Type: Array
- Description: File paths of attachments to be included in the email.
- Type: Array/Object
- Description: Additional data relevant to the email.
- Example Elements:
subject
: The subject of the email.name
: The name of the recipient.sitename
: The name of the site or organization.membership_id
: ID of the membership.membership_level_name
: Name of the membership level.membership_cost
: Cost of the membership.login_url
: URL for the user to log in.user_email
: Email address of the user.invoice_id
: ID of the invoice.invoice_total
: Total amount of the invoice.billing_name
: Name of the billing contact.billing_address
: Billing address.cardtype
: Type of card used for payment.expirationmonth
: Expiration month of the card.instructions
: Specific instructions or messages.invoice_link
: Link to the invoice.donation
: Donation amount, if applicable.
- Returns: Boolean
- Description: Sends the email. Returns true if successful.
- Parameters:
template_name
(String) - Returns: Void
- Description: Sets the email template to be used.
- Parameters: None
- Returns: String
- Description: Returns the name of the current email template.
- Parameters: None
- Returns: Void
- Description: Applies the selected template to the email.
- Parameters:
body
(String) - Returns: Void
- Description: Sets the body of the email.
- Parameters:
subject
(String) - Returns: Void
- Description: Sets the subject of the email.
- Parameters:
attachment
(String) - Returns: Void
- Description: Adds an attachment to the email.
$email = new PMProEmail();
$email->email = "[email protected]";
$email->subject = "Welcome to Our Service!";
$email->body = "This is an example email body.";
$email->data = ['membership_level' => 'Gold', 'expiry_date' => '2023-12-31'];
$email->send();