Freeside:4:Documentation:Developer/FS/cust msg

From Freeside
Jump to: navigation, search

NAME

FS::cust_msg - Object methods for cust_msg records

SYNOPSIS

 use FS::cust_msg;

 $record = new FS::cust_msg \%hash;
 $record = new FS::cust_msg { 'column' => 'value' };

 $error = $record->insert;

 $error = $record->check;

DESCRIPTION

An FS::cust_msg object represents an email message generated by Freeside and sent to a customer (see FS::msg_template). FS::cust_msg inherits from FS::Record. The following fields are currently supported:

custmsgnum - primary key; custnum - customer number; msgnum - template number; msgtype - the message type; _date - the time the message was sent; env_from - envelope From address; env_to - envelope To addresses, including Bcc, separated by newlines; header - message header; body - message body (as a complete MIME document); preview - HTML fragment to show as a preview of the message; error - Email::Sender error message (or null for success); status - "prepared", "sent", or "failed"

METHODS

new HASHREF
Creates a new
insert
Adds this record to the database. If there is an error, returns the error and emits a warning; otherwise returns false.
delete
Delete this record from the database. There's no reason to do this.
replace OLD_RECORD
Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error and emits a warning, otherwise returns false.
check
Checks all fields to make sure this is a valid example. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
send
Sends the message through its parent FS::msg_template. Returns an error message on error, or an empty string.
entity
Returns the complete message as a MIME::Entity.
XXX this only works if the message in fact contains a MIME entity. Messages created by external APIs may not look like that.
parts
Returns a list of the MIME parts contained in the message, as MIME::Entity objects.

SUBROUTINES

process_send CUSTMSGNUM
Given a cust_msg.custmsgnum value, sends the message. It must already have been prepared (via "prepare" in FS/msg template|FS::msg_template#prepare|"prepare" in FS::msg_template).

SEE ALSO

FS::msg_template, FS::cust_main, FS::Record.

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 228:
You forgot a '=back' before '=head1'