1
1
1ss1za2020-05-22 17:50:07
PHP
1ss1za, 2020-05-22 17:50:07

How to change the sender's name in a letter?

How to change the sender's name to plain text instead of the address [email protected]

There is a handler:

<?php
if (isset($_POST['name'])) {$name = $_POST['name']; if ($name == '') {unset($name);}}
if (isset($_POST['phone'])) {$phone = $_POST['phone']; if ($phone == '') {unset($phone);}}
if (isset($_POST['title'])) {$title = $_POST['title']; if ($title == '') {unset($title);}}

 
if (isset($phone)){
$subject = "Заявка с сайта";
$address = "почта куда приходят заявки";
$mes = "Заявка с сайта \nТелефон: $phone \nИмя: $name \nИнтересует: $title";
$send = mail ($address,$subject,$mes,"Content-type:text/plain; charset = UTF-8\r\n");

}
?>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel Ataykin, 2020-05-22
@pavel_ataykin

Hey! The address "[email protected]" is the address of the timeweb SMTP server (where you buy hosting). That is, you bought a shared host there and when sending a letter, the SMTP server puts its signature. In this case, SMTP 1 for all shared hosting clients. If you want to take control of this string, you need a personal SMTP server.
Everything you can change is described in the documentation for the mail function
. You need to study the header section. There is an element "From" it will help you to edit from whom the letter came. But the address "[email protected]" will remain in the letter as the server that signed the letter.

G
galaxy, 2020-05-22
@galaxy

In headers: "From: User <[email protected]>"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question