Jump to content

[Advanced] get data from object to send email


apositivo

Recommended Posts

Good greetings to all prestashop community!


this is to make an inquiry ... I think we would say advanced ...

 

classes folder have the Mail.php file, which performs the logic for email (eg Welcome) in that class have the Send method :

public static function Send($id_lang, $template, $subject, $template_vars, $to,
        $to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null,
        $template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null, $bcc = null)
    { ....}

This object is constructed with swift library

 

 

at the end of this method we have:

/* Send mail */
            $send = $swift->send($message, $to, new Swift_Address($from, $from_name));
            $swift->disconnect();

            ShopUrl::resetMainDomainCache();

 $message is an object has a lot of data, to, from, reply to, among others .... also contains message in html format to be sent to the client. . .


as I can get the content of this vaiable that has the html ?????

 

example

 

$message->body  , ???

$message->content  ???

$message-> data ????

 

 

 

object structure

Swift_Message Object
(
[mimeWarning:protected] => This is a message in multipart MIME format. Your mail client should not be displaying this. Consider upgrading your mail client to view this message correctly.
[libVersion:protected] => 3.3.2
[references:protected] => Array
(
[parent] => Array
(
[alternative] => Swift_Message_Part Object
(
[headers] => Swift_Message_Headers Object
(
[emailContainingHeaders:protected] => Array
(
[0] => To
[1] => From
[2] => Reply-To
[3] => Cc
[4] => Bcc
[5] => Return-Path
[6] => Sender
)

[encoding:protected] => B
[charset:protected] => iso-8859-1
[headers:protected] => Array
(
[Content-Type] => multipart/alternative
[Content-Transfer-Encoding] => 7bit
)

[lowerHeaders:protected] => Array
(
[content-type] => multipart/alternative
[content-transfer-encoding] => 7bit
)

[attributes:protected] => Array
(
[content-type] => Array
(
[charset] =>
[format] =>
[boundary] => _=_swift-7768673955534577b6be382.72631708_=_
)

)

[forceEncoding:protected] =>
[language:protected] => en-us
[cached:protected] => Array
(
[content-type] => multipart/alternative;
boundary="_=_swift-7768673955534577b6be382.72631708_=_"
[content-transfer-encoding] => 7bit
)

[LE:protected] =>

)

[data:protected] =>
[wrap:protected] => 1000
[children:protected] => Array
(
[5534577b650c8] => Swift_Message_Part Object
(
[headers] => Swift_Message_Headers Object
(
[emailContainingHeaders:protected] => Array
(
[0] => To
[1] => From
[2] => Reply-To
[3] => Cc
[4] => Bcc
[5] => Return-Path
[6] => Sender
)

[encoding:protected] => B
[charset:protected] => iso-8859-1
[headers:protected] => Array
(
[Content-Type] => text/html
[Content-Transfer-Encoding] => 8bit
)

[lowerHeaders:protected] => Array
(
[content-type] => text/html
[content-transfer-encoding] => 8bit
)

[attributes:protected] => Array
(
[content-type] => Array
(
[charset] => utf-8
[format] =>
)

)

[forceEncoding:protected] =>
[language:protected] => en-us
[cached:protected] => Array
(
[content-type] => text/html; charset=utf-8
[content-transfer-encoding] => 8bit
)

[LE:protected] =>

)

[data:protected] =>

----------> This is the content of HTML that I would get the object $message --------->>>>

 

Hi Pepe   Account details   Thank you for creating a customer account in Tusitio.com.

These are your access data:


E-mail: [email protected]
Pass: 123456   Safety tips:

     Keep your account information in a safe place.
     Do not share your account details with anyone.
     Change your password regularly.
     If you suspect someone is using your account illegally, contact us immediately.
  Now you can place orders in our store: YourStore.com

Edited by apositivo (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...