Skip to content

Mail is going to spam #27

@2waygithub

Description

@2waygithub

Dude this library is sending the emails in spam. Find the code below -

$mailService = $this->getServiceLocator()->get('goaliomailservice_message');
$content = new MimeMessage();
$htmlPart = new MimePart("Please find attached this report received from a " . $clientName . " user.

Regards,
" . $this->zfcUserAuthentication()->getIdentity()->getDisplayName() . "



");
$htmlPart->type = 'text/html';
$textPart = new MimePart("Please find attached this report received from a " . $clientName . " user.

            Regards,
            " . $this->zfcUserAuthentication()->getIdentity()->getDisplayName());
    $textPart->type = 'text/plain';
    $content->setParts(array($textPart, $htmlPart));

    $contentPart = new MimePart($content->generateMessage());
    $contentPart->type = 'multipart/alternative;' . PHP_EOL . ' boundary="' . $content->getMime()->boundary() . '"';

    $attachment = new MimePart(fopen($pdfPath, 'r'));
    $attachment->type = 'application/pdf';
    $attachment->filename = 'report' . time() . '.pdf';
    $attachment->encoding = Mime::ENCODING_BASE64;
    $attachment->disposition = Mime::DISPOSITION_ATTACHMENT;

    $body = new MimeMessage();
    $body->setParts(array($contentPart, $attachment));

    $message = new Message();
    $message->setEncoding('utf-8')
            ->addTo($email)
            ->addFrom(array($this->getLoggedInUserAdminFromEmail() => $this->getLoggedInUserAdminContactName()))
            ->setSubject($this->getLoggedInUserAdminContactName().' Report')
            ->setBody($body);
    try {
        $mailService->send($message);
    } catch (\Exception $e) {
        
    }

mail_snapshot

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions