E-mail Library



( ZN >= 1.0.0 )

The class that performs the function of sending e-mail.

 

# Methods


this settings ( Array $ settings = NULL )
this to ( Mixed $ to , String $ name )
this receiver ( Mixed $ to , String $ name )
this replyTo ( Mixed $ replyTo , String $ name )
this cc ( Mixed $ cc , String $ name )
this bcc ( Mixed $ bcc , String $ name )
this from ( String $ from , String $ name = NULL , String $ return Path = NULL )
this sender ( String $ from , String $ name = NULL , String $ return Path = NULL )
this subject ( String $ subject )
this message ( String $ message )
this content ( String $ message )
this template ( String $ message , Mixed $ columnOrData , Array $ data = [] )
this attachment ( String $ file , String $ dis  = NULL , String $ newName = NULL , Mixed $ mime = NULL )
Mixed attachmentContentId ( String $ filename )
this addHeader ( String $ header , String $ value )
Bool send ( String $ subject = NULL , String $ message = NULL )
Mixed error ( Void )
this driver ( String $ driver )
this contentType ( String $ type = 'plain' )
this charset ( String $ charset = 'UTF-8' )  
this priority ( Int $ count = 3 )
this encodingType ( String $ type = '8bit' )
this multiPart ( String $ multiPart = 'related' )
this smtpHost ( String $ host )
this smtpUser ( String $ user )
this smtpdsn ( Boolean $ DSN = true )
this smtpPassword ( String $ pass )
this smtpPort ( Int $ port = 587 )
this smtpTimeout ( Int $ timeout = 10 )
this smtpkeepaliv to ( Boolean $ KeepAlive = true )
this smtpEncode ( String $ encode )

 

# Configuration


File: Config / Services.php
E-mail
String $ driver = 'smtp' It is specified which drive to send the e-mail to.
Options smtp , mail , send , imap , pipe
SMTP
String $ host = '' The name of the e-mail server.
String $ user = '' Email username.
String $ password = '' Email user password.
Int $ port = 587 Server connection port.
Bool $ keepAlive = false Enable persistent SMTP connections.
Int $ timeout = 10 Connection timeout duration.
String $ encode = '' SMTP connection encryption type.
Options tls , ssl
Bool $ dsn = false Report the message to the server.
Bool $ auth = true Keeping an email user logged on.
General
String $ senderMail = '' Predefined sender email address.
String $ senderName = '' Predefined sender name.
Int $ priority = 3 Priority level
Options 1 = Highest. 5 = Lowest. 3 = Normal.
String $ charset = 'UTF-8' Email character set.
String $ contentType = 'html' E-mail content type. 
Options html , plain
String $ multiPart = 'mixed'  
Options mixed , related , alternative
String $ xMailer = 'ZN'  
String $ encoding = '8bit' Encoding type.
Options 8bit , 7bit
String $ mimeVersion = '1.0' Mime version
String $ mailPath = '/ usr / sbin / sendmail' Server e-mail route.

 

# Settings ( ZN> = 3.0.0 )


E-mail sending settings are normally made via the Config / Services.php file. However, in some cases this method is used if you need to configure the settings at the time of sending. Usually the predefined settings are sufficient. This method is used if you need to send multiple emails with different connections.

ones are they

Array $ settings Settings to configure.
return this

Use of

Email::settings
     ([
         'smtpHost'     => 'mail.example.com', 
         'smtpUser'     => 'example@example.com', 
         'smtpPassword' => '1234'
     ])
     ->sender('bilgi@zntr.net', 'ZNTR')
     ->receiver('ornek@ornek.com')
     ->subject('Konu')
     ->message('Mesaj')
     ->send();

 

# To / Receiver ( ZN >= 1.0.0 )


E-mail is used to create recipient information. Both methods are the same in task.

Parameters

Mixed $ Tomaili Recipient email address. This parameter accepts an array if multiple submissions are to be made.
String $ Tonnes Game Buyer name.
return this

Use of

Email::to('to@example.com', 'To Example');

If multiple recipient information is added, it can be used as it is.

Email::to('to1@example.com', 'To 1')
     ->to('to2@example.com', 'To 2')
     ->to('to3@example.com', 'To 3')

Multiple recipients can be specified in the array.

Email::to(['to1@example.com' => 'To1', 'to2@example.com' => 'To2']);

 

# ReplyTo ( ZN> = 1.0.0 )


The e-mail sender creates recipient information for sending to the person.

Parameters

Mixed $ Tomaili Recipient email address. This parameter accepts an array if multiple submissions are to be made.
String $ Tonnes Game Buyer name.
return this

Use of

Email::replyTo('to@example.com', 'To Example');

If multiple recipient information is added, it can be used as it is.

Email::replyTo('to1@example.com', 'To 1')
     ->replyTo('to2@example.com', 'To 2')
     ->replyTo('to3@example.com', 'To 3')

Multiple recipients can be specified in the array.

Email::replyTo(['to1@example.com' => 'To1', 'to2@example.com' => 'To2']);

 

# CC ( ZN >= 1.0.0 )


Used to create multiple e-mail recipients.

Parameters

Mixed $ Tomaili Recipient email address. This parameter accepts an array if multiple submissions are to be made.
String $ Tonnes Game Buyer name.
return this

Use of

Email::cc('to@example.com', 'To Example');

If multiple recipient information is added, it can be used as it is.

Email::cc('to1@example.com', 'To 1')
     ->cc('to2@example.com', 'To 2')
     ->cc('to3@example.com', 'To 3')

Multiple recipients can be specified in the array.

Email::cc(['to1@example.com' => 'To1', 'to2@example.com' => 'To2']);

 

# BCC ( ZN >= 1.0.0 )


Used to create multiple e-mail recipients. CC 'e-mail addresses are not visible to buyers.

Parameters

Mixed $ Tomaili Recipient email address. This parameter accepts an array if multiple submissions are to be made.
String $ Tonnes Game Buyer name.
return this

Use of

Email::bcc('to@example.com', 'To Example');

If multiple recipient information is added, it can be used as it is.

Email::bcc('to1@example.com', 'To 1')
     ->bcc('to2@example.com', 'To 2')
     ->bcc('to3@example.com', 'To 3')

Multiple recipients can be specified in the array.

Email::bcc(['to1@example.com' => 'To1', 'to2@example.com' => 'To2']);

 

# From / Sender ( ZN >= 1.0.0 )


Used to create e - mail sender information.

Parameters

String $ frommail Sender's email address.
String $ fromName = NULL Sender name.
String $ return Path = NULL Specifies which adrese will be forwarded to non-delivery e-mails.
return this

Use of

Email::from('from@example.com', 'Example', 'from2@example.com')
     ->to('to@example.com', 'To')
     ->content('Message')
     ->subject('Subject')
     ->send();

 

# Subject ( ZN >= 1.0.0 )


It is used to specify the subject of the e-mail address to be sent.

Parameters

String $ subject Topic.
return this

Use of

Email::subject('This E-posta is Examples');

 

# Message / Content ( ZN >= 1.0.0 )

Used to specify the content of the e-mail address to be sent. In both methods above, the task is the same.

Parameters

String $ content Content.
return this

Use of

Email::subject('This Mail is Examples')
     ->message('Hi, This mail is examples.');

 

# Template ( ZN >= 5.3.7 )


This method is used to send email content in the form of a template. The method message()or content()method is not used when this method is used. It is very useful for sending formatted content. There are several forms of use. If you want to save it in the database orResources / Templates / you can use the templates in the directories for submission.

Use with Database Templates

This is for your email templates saved in the usage database. Key phrases that you use to format your templates should be used in the form key .

Parameters

String $ tableandcolumn Table and column name. Which table and column to pull the template from. Use of: Table_Name: column_name
String $ Wherecolumnandvalu to Which template to use. Use of: column_name: value
Array $ data = [] Matches the template with the data. the template name match.
return this

uses

This usage is used to pull the template directly from the database.

+ ---- + --------- + ---------------- + ----------------- +
| ID | NAME    | CONTENT        | EMAIL_TEMPLATES |    
+ ---- + -------------------------- + ----------------- +
| 1 | example | Hello { { name } } |
+ ---- + -------------------------------------------- + 
Email::sender('robot@znframework')
     ->receiver('example@znframework.com')
     ->subject('Example')
     ->template('email_templates:content', 'name:example', 
     [
         'name'  => 'ZN'
     ])
     ->send();

Use with Index Templates

External / Resources / Templates / or Project / Resources / Templates / Template files saved into directories are used.

Parameters

String $ tableandcolumn Template name to be sent. The file name in the specified directories.
Array $ data = [] Data to be sent.
return this

uses

File: Resources / Templates / example.wizard.php
Name $name
File: Controllers / Home.php
Email::subject('Example')->template('example', ['name' => 'ZN'])->send();

 

# Attachment ( ZN >= 1.0.0 )


Used to attach an attachment to an e-mail message when sending an e-mail. These attachments can be files, pictures, etc ....

Parameters

String $ file File path / name i.
String $ disposition = NULL Attractiveness. Most email clients make their own decisions, independent of the MIME specification used here.
Options Content Disposition Values
String $ newName = NULL The name of the file in e-mail.
Mixed $ mime = NULL The type of mime you have. In this parameter,  you can add mime types to your Settings / Expressions.php file.
return this

Use of

Email::attachment('image.jpg');
     ->attachment('text.txt', 'inline', 'content.txt', 'text/plain');
Email::attachment('example/files/word.pdf', 'attachment', 'word.pdf', 'pdf');

 

# AttachmentContentID ( ZN >= 1.0.0 )


Returns the Content-ID of an attachment that allows an image attachment to be placed in HTML.

Parameters

String $ file File path / name i.
return Mixed

Use of

Email::attachment('image.jpg')
     ->to('to@example.com')
     ->from('from@example.com')
     ->message(Html::image('Content-ID:' . Email::attachmentContentId('image.jpg')))
     ->send();

 

# AddHeader ( ZN >= 1.0.0 )


It can be used to add header information to an e-mail.

Parameters

String $ key The header key to add.
String $ Value It's worth the top-level information.
return this

Use of

Email::attachment('image.jpg')
     ->to('to@example.com')
     ->from('from@example.com')
     ->addHeader('Header-Example', 'Header Example')
     ->addHeader('Data', 'Example Data')
     ->send();

 

# Send ( ZN >= 1.0.0 )


It is the final method of sending e-mail. Every e-mail should end with this method.

Parameters

String $ subject = NULL Can be used instead of the subject () method.
String $ message = NULL Can be used instead of the message () method.
return Bool

Use of

Email::from('from@example.com')
     ->to('to@example.com')
     ->send('This is Subject', 'This is message.');

 

# Error ( ZN >= 1.0.0 )


It is a way of telling what the problem is when there is a problem with sending an e-mail.

Parameters

void
return Mixed

Use of

Email::from('from@example.com')
     ->to('to@example.com')
     ->send('This is Subject', 'This is message.');

output(Email::error());