# Email

### **ccb\_email\_attachment**&#x20;

This is a hook to add existing files inside WP.

**Parameters:**

* **$attachments(Array)**
* **$calc\_id(Integer)**

**Example:**

```php
add_filter('ccb_email_attachment', 'add_attachment', 10, 2);

function add_attachment($attachments, $params){
if ( $params['calcId'] == 257) { //change 257 to the ID of your calculator 
  $attachments[] = ABSPATH .'wp-content/uploads/2023/10/filename.pptx'; //set the ABSOLUTE path to the file here  
}
	return $attachments;	
}
```

### **ccb\_email\_rich\_text**&#x20;

This hook allows you to turn off rich text format in summary, as well as customize the text itself.

**Parameters:**

* **$description(String)**
* **$calc\_id(Integer)**

**Example:**

```php
add_filter('ccb_email_rich_text', 'disable_rich_text', 20, 2);

function disable_rich_text($description, $calc_id){
	if($calc_id == 257){
		$description = strip_tags($description);
	}
	
	return $description;
}
```

### **ccb\_email\_body\_client**&#x20;

This is a hook for changing the content of the email for clients.

**Parameters:**

* **$template(String)**

**Example:**

```php
add_filter('ccb_email_body_client', 'change_email_client_content', 10, 1);

function change_email_client_content($template){
	$template = '
		<html>
		<header>Demo Email Client</header>
		<body>
			<p> Demo email client content </p>	
		</body>
		</html>	
	';	
	return $template;
}
```

### **ccb\_email\_body\_user**&#x20;

This is a hook to change the content of the email for users.

**Parameters:**

* **$template(String)**

**Example:**

```php
add_filter('ccb_email_body_user', 'change_email_user_content', 10, 1);

function change_email_user_content($template){
	$template = '
		<html>
		<header>Demo Email User Content</header>
		<body>
			<p> Demo email user content </p>	
		</body>
		</html>	
	';	
	return $template;
}
```

### **ccb\_email\_header**&#x20;

This hook allows you to change the header of the message.

**Parameters:**

* **$footer\_content(String)**
* **$calc\_id(Integer)**

**Example:**

```php
add_filter('ccb_email_header', 'change_header_content', 10, 2);
function change_header_content($header, $args){
	if($args['calc_id'] == 257){
		$header = 'From: DemoPage  <vineere@gmail.com>
Content-Type: text/html; charset=UTF-8';		
	}
	return $header;
}
```

### **ccb\_email\_footer**&#x20;

This hook allows you to change the footer of the email.

**Parameters:**

* **$footer\_content(String)**
* **$calc\_id(Integer)**

**Example:**

```php
add_filter('ccb_email_footer', 'custom_footer_function', 10, 2);

function custom_footer_function($footer_content, $calc_id){
	if($calc_id == 257){
		$footer_content = '<p>This is a demo footer content</p>';
	}
	return $footer_content;
}
```

### **ccb\_email\_date**&#x20;

This is a hook that changes the date of sending the email or allows to change the format of the date of sending the email.

**Parameters:**

* **$email\_date(String)**
* **$calc\_id(Integer)**

**Example:**

```php
add_filter('ccb_email_date', 'custom_email_date', 10, 2);
function custom_email_date($email_date, $calc_id){
	if($calc_id == 257){
		$email_date = gmdate("M d Y H:i:s") ."\n";
	}
	return $email_date;
}
```

### **ccb\_email\_logo\_style**

This is a hook for changing company logo styles.

**Parameters:**

* **$logo\_style(String)**
* **$calc\_id(Integer)**

**Example:**

```php
add_filter('ccb_email_logo_style', 'custom_email_logo_style', 10, 2);
function custom_email_logo_style($logo_style, $calc_id){
	if($calc_id == 257){
		$logo_style = 'margin:50px; background:green;';
	}
	return $logo_style;
}
```

### **ccb\_email\_logo\_html**&#x20;

This is a hook to add custom HTML code to the company logo block.

**Parameters:**

* **$email\_logo(String)**
* **$calc\_id(Integer)**

```php
add_filter('ccb_email_logo_html', 'custom_email_logo_html', 10, 2);
function custom_email_logo_html($email_logo, $calc_id){
	if($calc_id == 257){
		$email_logo = '<p>This is a demo logo content</p>';
	}
	return $email_logo;
}
```

### **ccb\_email\_title**&#x20;

This is a hook to change the title of the email.

**Parameters:**

* **$email\_title(String)**
* **$calc\_id(Integer)**

```php
add_filter('ccb_email_title', 'custom_email_title', 10, 2);
function custom_email_title($email_title, $calc_id){
	if($calc_id == 257){
		$email_title = 'Custom Email Title';	
	}

	return $email_title;
}
```
