Score:0

Php mail transmission error using postfix

gn flag

I need your help

I am using AWS and ubuntu os 20.04. The web server uses nginx and uses php mail I installed php 7.3 pfm.

I used postfix for mail function and connected to SMTP. It's not Google, it's an e-mail called NAVER Works used in Korea.

On the server

server code

"This is Test" | mail -s "This is the subject" [email protected] - aFrom:[email protected]

I checked that the mail was sent using . But without -aFrom, I couldn't send the mail

After adding, I checked the transfer and called php mail on the React web, but from is always empty In the to part, it's sent as [email protected]

So my problem is this

Why is from=<> when from is set? And I wonder why it is set as www-data.

error code

Nov 25 16:41:52 grigompictures postfix/sendmail[5817]: warning: /etc/postfix/main.cf, line 66: overriding earlier entry: smtp_tls_security_level=may
Nov 25 16:41:52 grigompictures postfix/postdrop[5818]: warning: /etc/postfix/main.cf, line 66: overriding earlier entry: smtp_tls_security_level=may
Nov 25 16:41:52 grigompictures postfix/cleanup[5819]: warning: /etc/postfix/main.cf, line 66: overriding earlier entry: smtp_tls_security_level=may
Nov 25 16:41:52 grigompictures postfix/pickup[5051]: 15DA1BE058: uid=33 from=<www-data>
Nov 25 16:41:52 grigompictures postfix/trivial-rewrite[5820]: warning: /etc/postfix/main.cf, line 66: overriding earlier entry: smtp_tls_security_level=may
Nov 25 16:41:52 grigompictures postfix/cleanup[5819]: 15DA1BE058: message-id=<20221125074152.15DA1BE058@localhost>
Nov 25 16:41:52 grigompictures postfix/qmgr[5052]: 15DA1BE058: from=<[email protected]>, size=581, nrcpt=1 (queue active)
Nov 25 16:41:52 grigompictures postfix/smtp[5821]: warning: /etc/postfix/main.cf, line 66: overriding earlier entry: smtp_tls_security_level=may
Nov 25 16:41:52 grigompictures postfix/bounce[5822]: warning: /etc/postfix/main.cf, line 66: overriding earlier entry: smtp_tls_security_level=may
Nov 25 16:41:52 grigompictures postfix/smtp[5821]: 15DA1BE058: to=<[email protected]>, relay=smtp.worksmobile.com[125.209.209.241]:587, delay=0.23, delays=0.02/0.08/0.12/0.01, dsn=5.7.1, status=bounced (host smtp.worksmobile.com[125.209.209.241] said: 554 5.7.1 The sender address is unauthorized oDOdys8sRN6Y7rp0-9gUJg - nsmtp (in reply to MAIL FROM command))
Nov 25 16:41:52 grigompictures postfix/cleanup[5819]: 57876BE05A: message-id=<20221125074152.57876BE05A@localhost>
Nov 25 16:41:52 grigompictures postfix/qmgr[5052]: 57876BE05A: from=<>, size=2672, nrcpt=1 (queue active)
Nov 25 16:41:52 grigompictures postfix/bounce[5822]: 15DA1BE058: sender non-delivery notification: 57876BE05A
Nov 25 16:41:52 grigompictures postfix/qmgr[5052]: 15DA1BE058: removed
Nov 25 16:41:52 grigompictures postfix/smtp[5821]: 57876BE05A: to=<[email protected]>, relay=smtp.worksmobile.com[125.209.209.241]:587, delay=0.11, delays=0/0/0.1/0.01, dsn=5.7.1, status=bounced (host smtp.worksmobile.com[125.209.209.241] said: 554 5.7.1 The sender address is unauthorized XNcP6WgcSGqQfw5Gz7ApyQ - nsmtp (in reply to MAIL FROM command))

php code

<?php
    header("Access-Control-Allow-Origin: *");
    header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");
    header("Access-Control-Allow-Headers: X-PINGOTHER, Content-Type, Authorization");
    header("Access-Control-Max-Age: 86400");

    $rest_json = file_get_contents("php://input");
    $_POST = json_decode($rest_json, true);

    // company - 회사명
    // number - 회사번호
    // email - 이메일
    // name - 담당자 명
    // phone - 담당자 전화번호
    // message - 메세지

    $to = "[email protected]";
    $subject = "Grigom_Pictures CONTACT MAIL - ".$_POST['company'];

    $contents= nl2br(
        "회사명 : ".$_POST['company']."\n".
        "회사번호 : ".$_POST['number']."\n".
        "이메일 : ".$_POST['email']."\n".
        "담당자 명 : ".$_POST['name']."\n".
        "담당자 전화번호 : ".$_POST['phone']."\n".
        "내용 : ".$_POST['message']."\n"
    );

    $headers = implode("\r\n", [
        "From: [email protected]",
        'MIME-Version: 1.0',
        'Content-Type: text/html; charset=UTF-8',
        'X-Mailer: PHP/' . PHP_VERSION
    ]);
    mail($to, $subject, $contents, $headers);

?>
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.