Welcome Guest, Not a member yet? Register   Sign In
Strange sender of emali...
#1
Bug 

Hello there, here I am (again)...

I want to use SMTP in a project, and it work. 
BUT
I set the 

Code:
$email->setFrom('[email protected]', 'MySender');

and in the recieved mail is given following: SandBox CI4 ([email protected]),
but I want to get THIS: MySender ([email protected])

Where the hell is the "SandBox CI4" from ?!?

I searched the folder of my installation, but I got no results...

Where to set the correct sender of the email ?
Reply
#2

(05-12-2022, 03:07 AM)Codinglander Wrote: but I want to get THIS: MySender ([email protected])

I checked, there is no problem.
Providing more code details can help solve your problem.

[Image: screenshot_2022-05-12_142727_04g0.jpg]
Reply
#3

Here are all the settings I made related to the email class:

Controller:

PHP Code:
public function testEmail()
    {
        $email service('email');
        $email->setFrom('[email protected]''St.Barbara Familienzentrum');
        $email->setTo('[email protected]');
        $email->setSubject("Eine Test-Email");
        $email->setMessage("<h1>Hallo Testnachricht</h1>");
        if ($email->send()) {
            echo "Nachricht gesendett...";
        } else {
            echo $email->printDebugger();
        }
    

.env file
PHP Code:
email.SMTPHost 'myhost.provider.com'
email.SMTPUser 'myUserName'
email.SMTPPass 'xXxXxXxXxX'
email.SMTPPort '587'
email.SMTPCrypto 'tls' 
(With my correct credentials sending emails is working)

Email-Config:
PHP Code:
<?php

namespace Config;

use 
CodeIgniter\Config\BaseConfig;

class 
Email extends BaseConfig
{
    /**
    * @var string
    */
    public $fromEmail '[email protected]';

    /**
    * @var string
    */
    public $fromName 'St.Barbara Familienzentrum';

    /**
    * @var string
    */
    public $recipients;

    /**
    * The "user agent"
    *
    * @var string
    */
    public $userAgent 'CodeIgniter';

    /**
    * The mail sending protocol: mail, sendmail, smtp
    *
    * @var string
    */
    public $protocol 'smtp';

    /**
    * The server path to Sendmail.
    *
    * @var string
    */
    public $mailPath '/usr/sbin/sendmail';

    /**
    * SMTP Server Address
    *
    * @var string
    */
    public $SMTPHost;

    /**
    * SMTP Username
    *
    * @var string
    */
    public $SMTPUser;

    /**
    * SMTP Password
    *
    * @var string
    */
    public $SMTPPass;

    /**
    * SMTP Port
    *
    * @var int
    */
    public $SMTPPort 25;

    /**
    * SMTP Timeout (in seconds)
    *
    * @var int
    */
    public $SMTPTimeout 5;

    /**
    * Enable persistent SMTP connections
    *
    * @var bool
    */
    public $SMTPKeepAlive false;

    /**
    * SMTP Encryption. Either tls or ssl
    *
    * @var string
    */
    public $SMTPCrypto 'tls';

    /**
    * Enable word-wrap
    *
    * @var bool
    */
    public $wordWrap true;

    /**
    * Character count to wrap at
    *
    * @var int
    */
    public $wrapChars 76;

    /**
    * Type of mail, either 'text' or 'html'
    *
    * @var string
    */
    public $mailType 'html';

    /**
    * Character set (utf-8, iso-8859-1, etc.)
    *
    * @var string
    */
    public $charset 'UTF-8';

    /**
    * Whether to validate the email address
    *
    * @var bool
    */
    public $validate false;

    /**
    * Email Priority. 1 = highest. 5 = lowest. 3 = normal
    *
    * @var int
    */
    public $priority 3;

    /**
    * Newline character. (Use “\r\n” to comply with RFC 822)
    *
    * @var string
    */
    public $CRLF "\r\n";

    /**
    * Newline character. (Use “\r\n” to comply with RFC 822)
    *
    * @var string
    */
    public $newline "\r\n";

    /**
    * Enable BCC Batch Mode.
    *
    * @var bool
    */
    public $BCCBatchMode false;

    /**
    * Number of emails in each BCC batch
    *
    * @var int
    */
    public $BCCBatchSize 200;

    /**
    * Enable notify message from server
    *
    * @var bool
    */
    public $DSN false;


Nowhere I can see "SandBox CI4", but in my eMail Client this is the sender...
Reply
#4

Check with printDebugger:
https://codeigniter4.github.io/CodeIgnit...ntDebugger

The values are CI's email values.

If you do not see the same sender name, this may be due to your SMTPHost or your email client.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB