Adventure send a copy to the specified e-mail. How to anonymously send a message to a recipient? Text and background color

Adventure send a copy to the specified e-mail. How to anonymously send a message to a recipient? Text and background color

12.11.2021

Instruction

Go to mailbox and create a new one letter. Enter the first letter of the address, and you will see a list of recipients whose mailbox name begins with it. Select the desired e-mail from them and click on it with the mouse. In the corresponding window, the address will appear after it. Repeat the data entry for other recipients in the same way. Add the subject of the message, the text of the letter itself and the necessary attachments. Once you've completed the design, click the "Submit" button. Your letter will be received by all owners of the listed postal addresses. True, each of them will know that he is not the only recipient.

Take advantage of the address book. On different mail services, this service is implemented in its own way, but according to the same logic. At the end of the "to" line, there is an icon representing the address book. Addresses to which you have already sent messages are automatically added to it. Click on the symbol to open the entire list in front of you. Check the boxes next to those whom you want to add as recipients of this letter. Click the "Add Selected" button. The marked addresses will appear in the "to" line.

Enter the required data manually. You will have to do this if you have not sent letters to these addresses before. You must separate each of them with a comma and a space. For example: [email protected], [email protected], [email protected]

Please note that a maximum of 25 addresses can fit in the address bar. If you intend to send this message to more people, use the "cc" and "cc" fields.

Add recipients to the Bcc line if you don't want other recipients to know you're sending this letter not only to them. The dot will appear if you click on the “show all fields” offer or on the corresponding inscription above the “to” line. This method has a significant drawback: recipients may not receive your items. Mail system robots that fight spam delete such emails.

Enter the mailbox settings and create with the text you want to send to many recipients. And now manually for each address create letter, enter a recipient, and select a subject. It is enough to enter it once, and then it will appear in the drop-down line. Attach a file if necessary and click submit. This method allows you to avoid spam filters and give the impression that you are writing to this person. At the same time, it minimizes the amount of manual work.

Take advantage special programs for mass mailing. They allow you to send up to several hundred messages per minute and simplify all stages of writing letters as much as possible. Choose the most suitable program for you and download it from one of the thematic sites.

Sources:

  • Weapons of mass notification. How to organize your own newsletter
  • how to send a message to multiple recipients
  • Personalize emails for mass mailings with

It happens that you need to send several messages at once. This is usually how jokes, announcements and other information are distributed. There are special services and programs for this. They will send your messages in an instant.

You will need

  • - a computer;
  • - the Internet;
  • - eMail Mailer 4.2
  • - in addition, the program ePochta Subscription Manager

Instruction

For example, you can register at pistonposter.com. This service stable. Here you can create your own or blogs. Go to the "Projects" section. Enter your text that you plan to distribute. You can also find the "Action" option, under which there are several icons. Select a leaf image. The Send Message window will appear. Specify where and to whom your messages will be sent, and click the "Submit" button.

IN social network Vkontakte can also send several messages at the same time. messages. To do this, go to the "My messages" section and click on the "Write a message" button. Enter the text you need and in the "Recipient" field, select those to whom you want to send your letters.

ePochta Mailer 4.25 - for sending messages. It allows mass mailings to recipients. Download and install it on . You can find it on the website soft.softodrom.ru. Import the necessary e-mail and names of your recipients into it. Add text to be sent. After that, click on the "Start" button. Within a few seconds, all messages will be delivered.

In parallel with this program, it is desirable to install ePochta Subscription Manager. It will be needed for mass mailings. After installation, the program is automatically integrated into ePochta Mailer.

To add addresses, click on the "Import" button. In addition, ePochta Subscription Manager will be able to manage your email on its own. Go to "Settings" and set the options you need. To send a message, enter the text and email addresses. Delivery to recipients will occur within a few seconds. ePochta Subscription Manager will allow you to quickly work with messages.

Related videos

E-mail in Russia is now used very actively in private correspondence. In Western Europe and North America, a decade ago, this method began to be practiced not so much in private correspondence as for the exchange of business information within various organizations. And since it was quite often necessary to send messages to several colleagues at the same time, mail programs quickly received additional function to simplify the solution of this problem. Modern mail services have inherited and developed a mechanism for sending messages to several recipients simultaneously.

You will need

Instruction

If to send emails you are using an application installed in your operating system(for example, Microsoft Outlook or The Bat!) then run it and create a message that you want to send to multiple recipients.

List the email addresses of all recipients in the "To" field. Type them on one line, separated by a comma and a space. A semicolon (;) can be used instead of a comma. If all the addresses you need are in the address book of your mail client, then instead of manually entering it, you can use it. Depending on the program used, this action can be organized in different ways - for example, in The Bat application, click on the icon on the right side of the "To" field, and then in the window that opens, drag all the necessary addresses from the left field to the right. Another option is to check the checkboxes of the required lines of the list, and then click the right arrow button.

Similarly, you can use the "Copy" and "Bcc" fields. The main difference between placing a list of recipients in the "To" and "Cc" fields is the sort order and the convenience of finding messages that have already been sent. If you later need to find the text of this message, it is easier to search for it by the main recipient from the "To" field, and not by the whole list, which is better placed in the "Cc" field. The "Bcc" line differs from the "Cc" line in that the list placed in it will not be visible to any of the recipients.

Click the send button of the prepared message with the list of recipients filled in, and the application will start sending the message.

If you use a mail service hosted on an Internet server (for example, Gmail.com or Mail.ru), then filling in the fields that are described in the second and third steps must be done in the browser, and their names and purpose, as a rule, are the same with those used in the mail client. If your mail service is free, then most likely it has a limit on the number of recipients - for example, Mail.ru should not exceed 15. Check out the corresponding restrictions on your service before sending messages.

Sources:

  • How to send 1000 emails

Bulk email can be very useful if you need to send the same message to multiple addresses, it can make your job easier and save time. You just need to follow some rules.

You will need

  • - computer with internet access
  • - Email

Instruction

If you are going to send a letter to several email addresses from the mailbox to Mail.ru, select the "Write a letter" item, click on the "To" link, in the window that opens, check the boxes next to the addresses to which you want to send the letter. In this case, all your recipients will see other addresses to which you sent this message. If you do not want this, click on the "Hidden" link and select additional addresses.

If you want to send a letter by mailing from a mailbox to Rambler.ru, select the "Write a letter" item. By clicking on the "To" button, select the desired addresses and mark them in the drop-down list. If you need to hide the list of addresses from recipients, select the item "Bcc" and there - the desired addresses.

If the addresses you want to send mail to are not in your address book, you can enter them manually in the "To" field, separated by commas. You can also copy text letters, which you are going to send out, and simply insert it into each new letter for different recipients.

Related videos

note

If you are sending emails for commercial purposes, remember that emails sent mass mailing, are most often regarded as spam or do not reach the recipients and are immediately placed in the Spam folder, or simply deleted by the recipient. In any case, there will be little benefit for your business from such letters.

Useful advice

If you would like to send any offer, to avoid instant deletion of your email as spam, make your messages as personalized as possible, contact the person who owns the email address. You can paste in finished text the names of the recipients, and they will treat your letter more carefully than if it immediately begins with the words “Hurry up to buy!...”, etc.

Sources:

  • How to send a personalized newsletter using Gmail and Google Docs

Do you need to send e-mail invitations to a party or important information to several people? Sending each a letter is long and difficult. Much easier to send one letter to multiple addresses.

You will need

  • - Computer with internet connection
  • - Postal service or customized mail client on the computer

Instruction

Go to your mail. It can be either a mail client installed on the computer, or one of free services- in this situation, it doesn't matter at all, because the mailing scheme is the same for any option.

Open the form for creating a new letter. Type your text. Make sure that the text is universal, suitable for sending to any of the recipients. Fill in the "Subject" field, if required - attach pictures, texts or other files.

Open the address book. Find in it the recipients to whom you are going to send your letter and add them to the "To" line. Different systems and email clients allow you to enter a different number of addresses; perhaps, if there are many recipients, you will have to make several letters. If the addresses of those to whom you want to transfer information are not in your address book, enter these addresses into the line manually, separated by commas.

For most of the last 40 years, users had to take a leap of faith every time they opened email. Do you think that the letter really comes from the person indicated in the sender column? Most will easily answer “yes” and in fact be very surprised to learn how easy it is to spoof email from almost any sender.

When the Internet was created, no way to verify the identity of the sender was originally developed. During the development of major email protocols, the costs of computing power, implementation, and ease of use were balanced against the risk of fraud. It was hard to imagine that 84% of all email in the future will have a malicious load and be phishing or spam.

The result is that email headers, including the "From:" and "Reply-to:" fields, are very easy to spoof. In some cases, this is as simple as typing " [email protected]" in the "From:" field. Combine this with unsuspicious content, compelling graphics, and formatting, and it's entirely possible to fool people into thinking that the message in their inbox really came from a bank, the IRS, an executive, or the president of the United States.

Considering the ubiquity of e-mail, you understand the basis of our current crisis. information security. Weakness in email has led to a slew of phishing attacks designed to trick people into clicking on malicious links, downloading and opening malicious files, submit a W-2 form (an equivalent of 2-personal income tax in the US) or transfer funds to criminal accounts.

More recently, Coupa, a Silicon Valley company, was in the spotlight after sending payroll data of all 625 employees to a scammer. Last year, one of the largest companies in Europe, Leoni AG, lost $45 million when an employee mistakenly transferred money to account scammer due to fake email. According to the FBI, phishing attacks of the "compromise" type business correspondence” (BEC - Business Email Compromise), costing US companies $3 billion a year.

Databreaches.net has compiled a W-2 Phishing Fact List. Work on the list this year indicates that the number of cases has been on the rise since 2016 and currently consists of 204 reports. From the list, you can understand that there are known cases of data theft of thousands of employees and this type of fraud is very common.

How an attacker can spoof an insecure email from almost anyone in less than 5 minutes

In fact, a fake address in the "from" field is the basis and initial stage of most attacks. Why bother with email spoofing from a fictitious "company.com" when it's possible to just register a similar fake domain (like c0mpany.com) and use it? Or create an account Gmail entry ([email protected]), give her a friendly name that looks like the name of the company's CEO? Because, in fact, fake sending an email from a real person's address is even easier than registering a fake domain or creating a Gmail account.

Three easy ways

On the Internet you can easily find sites, which allow you to send fake emails. There are dozens of them, just a couple of examples: spoofbox.com and anonymailer.net. Many of them are free, some cost money, these services are positioned as legitimate, and the main purpose of using them is to prank friends.

The usage algorithm is simple. All you need to do is enter the recipient's email address in the "To:" field, put any desired email address in the "From:" field, and after creating the message, confirm sending. According to the terms of the user agreement, the responsibility for damage lies entirely with the customers of the service.

The next way is to send with command line UNIX. If you have a computer with mail service configured, just enter this command:

Mail-aFrom: [email protected]

The result is a message in which the "From" field will contain " [email protected]". After entering the subject line and the rest of the message, after pressing Ctrl+D, the message will be sent to the recipient. Whether this idea works depends on how your system is set up. However, it works in many cases.

Using PHP, you can create an email with a few lines of very simple code:


In fact, these are the lines of code used as an example in the online manual for the submit function mail() with additional caps/header.

These spoofing tools are highly simplified. It will take a little more work and of course social engineering skills to make the messages more realistic. But the main technical component is very simple. The only thing that really prevents spoofing is email authentication with sharing SPF records, DKIM signatures and DMARC. Next, we will describe how these technologies work and how they differ. They are nothing new, however, fortunately for scammers, most domains on the Internet are not yet secure. For example, only about 4% of .gov domains use authentication. What about the other 96%? Attackers can send emails disguised as coming from the mailboxes of these domains at any time.

Related articles on Habrahabr:

Remember how in the good old song they sing “Letter in an envelope, wait a minute - don’t tear ...”? Many in response will immediately say: “So this is, after all, when was it? Now, after all, e-mail!”. Of course it is. Actually, it is impossible to “break” or perform any other physical actions on a virtual message. But these are just nuances. E-mail, like its older brother, the post office, regularly delivers “news” to addressees - funny, sad, thoughtful, interesting and, of course, romantic.

Still, it’s a sin not to use such technology, you must agree! Only, of course, if there is no manic obsession to write letters to the addressee exclusively with a ballpoint pen and certainly in small handwriting. Although these are now few.

So, dear reader, this article will help you send an e-mail on popular services on the Web - Gmail, Yandex and Mail.ru. You will also learn from it how you can send an anonymous letter and send a document directly to text editor word.

How to send a letter correctly?

To send e-mail, regardless of the chosen service, you need to perform almost the same set of actions. Yes, and don't forget! You must have an account on the mail site. If not, check out our website for guides on how to creating an e-mail. This procedure is easy and simple.

gmail

Sending

1. On the profile page, in the upper left corner, click the red "Write" button.

2. On the first line of the form, type the recipient's mailbox address. You can also select a user from the address book (list of saved addresses) by clicking the word "To".

3. In the second line, sign the letter: indicate your name or initials so that the recipient immediately understands who the online message came from.

If you want to attach a statement or any document stored on Google Drive to the text, click its icon in the bottom bar, go to the storage and select required file. But if, for example, you want to download a scanned text in PDF format from a computer, then click on the “paperclip”.

You can also edit the text of the message, give it beautiful view(Important point! Especially if you send out a commercial offer with a link or an archive!). To perform this procedure, press the "A" button (the very first in the panel, on the left). And then, in the additional block, select the required function - “bold, italics”, “font settings”, “list creation”, etc.

to write an answer

When a letter, archive, application or some other document is received and you urgently need to send a response to the addressee, click once with the left button under the text of the message in the “Click here ...” field and fill out the form as described above.

You can also send electronic "news" to Gmail with Checker Plus for Gmail, an addon designed to monitor incoming mail. It is done like this:

1. Click the checker icon in the browser.

2. In the panel that opens, click the "pencil" button.

3. Fill in the fields of the opened form for sending.

Yandex

Sending

1. In the Yandex.Mail profile, in the row of buttons above the list of messages, click "Write".

2. In the "To" line, type the recipient's e-mail, in the "Subject" you can create a header for the letter.

3. Type the text and, if necessary, edit it using the functional panel above the field (font, color, alignment, emoticons).

Advice! If you make a mistake while typing, click the left arrow button to cancel the operation.

4. To send an archive, video or audio file stored on a PC with a letter, click the "Attach" button and download the necessary content. To download data from the Yandex.Disk storage, click the "Flying saucer" icon next to the same button.

5. When everything is ready, click "Submit" (you can click any of the buttons - at the top and bottom of the form).

to write an answer

Click the field under the received message, and the form with the specified addressee (the author of the letter) will immediately open on the display.

The Yandex browser extension for reading letters has exactly the same “Write” button as in the profile on the site. Click it and enter all the necessary data: the recipient's address, message and, if necessary, upload files. And if you have a question “Why is the message not being sent?”, Check the form for correct filling, you may have entered the e-mail incorrectly, and also view the Internet connection settings.

Mail.ru

Sending

1. Go to the "Mail" section.

2. Click "Write a letter" (the button located above the correspondence sections).

3. Fill in the "To" (e-mail addressee) and "Subject" (email header) fields.

4. Type the letter, edit it using the functional panel located above the field.

To send a file (for example, a scanned report), click the "Attach" option to upload data from a PC or the "Cloud" icon to provide a link to documents located in remote storage Mail.ru.

5. Click Submit.

to write an answer

To promptly send a reply to a received message, click the "Reply" button above its text. Then fill out the form as described above.

Click the Mail.ru addon icon. Click the email you want to reply to in the list. In the tab that opens, use the "Submit" option.

How to send a text document in the Word editor?

This operation can only be performed if an email client (eg Thunderbird, eM Client, Windows Live Mail, etc.) is installed on your computer.

Method number 1: fast shipping

  1. Click on Word document right button.
  2. IN context menu select: Send → Recipient.
  3. In the client, specify the recipient and activate the sending of a text file.

Method number 2: format selection

1. Open the prepared document in Word.

3. Select format:

  • "Send as attachments" - a full copy of the document as an attachment;
  • "... as PDF" - Text Document sent in PDF format;
  • "... as XPS" - an attachment in XPS format with formatting settings preserved.

How to anonymously send a message to a recipient?

If you want to hide your e-mail, use a special online service. On the Web, you can find a huge number of sites providing this service, but we will consider the most popular ones within the framework of this article.

(send-email.org)
Each message is sent from a different e-mail (automatically generates addresses). But still, it gives the user the opportunity to specify their "coordinates".

(http://www.theanonymousemail.com)
To make an anonymous mailing list on this service, you must register and indicate your real e-mail (it will not be displayed in the message).

(https://www.guerrillamail.com/)
The site provides the user with a temporary e-mail for a period of 1 hour. It allows you to send and read messages. You can delete your mailbox at any time.

Have a safe and comfortable stay online! About, .

According to various sources, from 50 to 95% of all emails in the world are spam from cyber scammers. The goals of sending such letters are simple: infect the recipient's computer with a virus, steal user passwords, force a person to transfer money "to charity", enter personal data bank card or send scans of documents.

Spam is often annoying at first sight: crooked layout, automatically translated text, password entry forms right in the subject line. But there are malicious letters that look decent, subtly play on a person's emotions and do not raise doubts about their veracity.

The article will talk about 4 types of fraudulent letters, which are most often followed by Russians.

1. Letters from “government organizations”

Fraudsters can pretend to be tax, the Pension Fund, Rospotrebnadzor, sanitary and epidemiological station and other government organizations. For persuasiveness, watermarks, scans of seals and state symbols are inserted into the letter. Most often, the task of criminals is to scare a person and convince him to open a file with a virus in an attachment.

Usually it is a ransomware or a Windows blocker that disables the computer and requires you to send a paid SMS to resume work. A malicious file can be disguised as a court order or a subpoena to call the head of the organization.

Fear and curiosity turn off the user's consciousness. Accountants' forums describe cases when employees of organizations brought files with viruses to their home computers, as they could not open them in the office due to antivirus.

Sometimes scammers ask you to send documents in response to a letter in order to collect information about the company that will be useful for other fraud schemes. Last year, a group of scammers managed to scam a lot of people by using the "fax paper request" distraction.

When an accountant or manager read this, he immediately cursed the tax office, “There are mammoths sitting there, e-mine!” and switched his thoughts from the letter itself to solving technical problems with sending.

2. Letters from "banks"

Windows blockers and ransomware can hide in fake letters not only from government organizations, but also from banks. The messages “A loan has been taken in your name, check out the lawsuit” can really scare and cause a great desire to open the file.

Also, a person can be persuaded to enter a false Personal Area, offering to see the accrued bonuses or receive a prize that he won in the Sberbank Lottery.

Less often, scammers send invoices to pay service fees and additional interest on a loan, for 50-200 rubles, which are easier to pay than to deal with.

3. Letters from "colleagues"/"partners"

Some people receive dozens of business letters with documents during the working day. With such a load, you can easily fall for the "Re:" tag in the subject line and forget that you have not corresponded with this person yet.

Especially if the poisoner field says "Alexander Ivanov", "Ekaterina Smirnova" or any simple Russian name that absolutely does not linger in the memory of a person who constantly works with people.

If the goal of fraudsters is not to collect SMS payments for unlocking Windows, but to harm a particular company, then letters with viruses and phishing links can be sent on behalf of real employees. A list of employees can be collected in social networks or viewed on the company's website.

If a person sees a letter in the mailbox from a person from a neighboring department, then he doesn’t look closely at it, he can even ignore antivirus warnings and open the file no matter what.

4. Letters from Google/Yandex/Mail

Google sometimes sends emails to Gmail owners saying that someone tried to log into your account or that Google Drive has run out of space. Fraudsters successfully copy them and force users to enter passwords on fake sites.

Fake letters from the "administration of the service" are also received by users of Yandex.Mail, Mail.ru and other mail services. Standard legends are: “your address has been blacklisted”, “password has expired”, “all emails from your address will be added to the spam folder”, “look at the list of undelivered emails”. As in the previous three paragraphs, the main weapons of criminals are the fear and curiosity of users.

How to protect yourself?

Install an antivirus on all your devices to automatically block malicious files. If for some reason you do not want to use it, then check all at least a little suspicious mail attachments on the virustotal.com

Never enter passwords manually. Use password managers on all devices. They will never offer you the option of passwords to enter on fake sites. If for some reason you do not want to use them, then manually type the URL of the page on which you are going to enter the password. This applies to all operating systems.

Wherever possible, enable SMS password verification or two-factor authentication. And of course, it is worth remembering that you cannot send scans of documents, passport data and transfer money to strangers.

Perhaps many of the readers, when looking at the screenshots of letters, thought: “Am I a fool to open files from such letters? From a mile away you can see that this is a set-up. I won't bother with a password manager and two-factor authentication. I'll just be careful."

Yes, most of the fraudulent emails can be exposed by eye. But this does not apply when the attack is directed specifically at you.

The most dangerous spam is personal


If a jealous wife wants to read her husband's mail, then Google will offer her dozens of sites that offer the service "Hacking mail and profiles in social networks without prepayment."

The scheme of their work is simple: they send high-quality phishing emails to a person, which are carefully composed, neatly laid out and take into account the personal characteristics of the person. Such scammers sincerely try to hook a specific victim. They find out from the customer her social circle, tastes, weaknesses. It may take an hour or more to develop an attack on a specific person, but the effort pays off.

If the victim is caught, they send the customer a screen of the box and ask them to pay (the average price is about $100) for their services. After the receipt of money, they send a password from the box or an archive with all letters.

It often happens that when a person receives a letter with a link to the file "Compromising evidence video on Tanya Kotova" (hidden keylogger) from his brother, he is filled with curiosity. If the letter is provided with a text with details that are known to a limited circle of people, then the person immediately denies the possibility that the brother could have been hacked or that someone else is pretending to be him. The victim relaxes and disables the goddamn antivirus to open the file.

Such services can be accessed not only by jealous wives, but also by unscrupulous competitors. In such cases, the price tag is higher and the methods are thinner.

Do not rely on your attentiveness and common sense. Just in case, let an emotionless antivirus and a password manager insure you.

P.S. Why do spammers write such “stupid” emails?


Carefully crafted scam emails are a relative rarity. If you go to the spam folder, you can have fun from the heart. What kind of characters are not invented by scammers to extort money: the director of the FBI, the heroine of the TV series "Game of Thrones", a clairvoyant who was sent to you by higher powers and he wants to tell the secret of your future for $ 15 dollars, a killer who ordered you, but he sincerely offers to pay off .

An abundance of exclamation marks, buttons in the body of the letter, a strange sender's address, an unnamed greeting, automatic translation, gross mistakes in the text, there is a clear overkill of creativity - letters in the spam folder simply “scream” about their dark origin.

Why do scammers who send their messages to millions of recipients not want to spend a couple of hours writing a neat letter and spare 20 bucks for a translator to increase the response of the audience?

In a Microsoft study Why do Nigerian Scammers Say They are from Nigeria? the question "Why do scammers continue to send letters on behalf of billionaires from Nigeria, when the general public has known about 'Nigerian letters' for 20 years," is deeply analyzed. According to statistics, more than 99.99% of recipients ignore such spam.

But one out of 10 thousand is underway and this person is an ideal victim who is completely divorced from reality and does not know how to use search engines. At risk are the mentally ill, and people who suffer from drug addiction and alcoholism in severe form.

A spammer who trades in extortion absolutely does not need relatively normal people to answer his letters. All of them will not transfer the money, but will simply distract with questions. He needs contacts of reference weirdos who will gladly send Daenerys $ 500, because the squirrel in their head approves of this.

Of these priceless specimens, the most solvent ones are selected and subjected to careful personal psychological processing. For example, a 50-year-old woman from the Kamchatka Territory recently translated 4.5 million rubles to the American military who found her in Odnoklassniki, fell in love, promised to marry, but after three months

One of the most requested functions on the site is the application or order form, the data from which is sent to the mail of the site owner. As a rule, such forms are simple and consist of two or three fields for data entry. How to create such an order form? This will require the use of the HTML markup language and the PHP programming language.

The HTML markup language itself is simple, you just need to figure out how and where to put certain tags. With the PHP programming language, things are a bit more complicated.

It is not difficult for a programmer to create such a form, but some actions may seem difficult for an HTML coder.

Creating an html submit form

The first line will be next

This is a very important form element. In it, we indicate how the data will be transferred and to which file. In this case, everything is transferred POST method send.php file. The program in this file, respectively, must accept the data, they will be contained in the post array, and send them to the specified email address.

Let's get back to the form. The second line will contain a field for entering a full name. Has the following code:

The form type is text, that is, the user will be able to enter or copy text here from the keyboard. The name parameter contains the name of the form. In this case, it is fio, it is under this name that everything that the user enters in this field will be transmitted. The placeholder parameter specifies what will be written in this field as an explanation.

Next line:

Here, almost everything is the same, but the name for the field is specified as email, and the explanation is specified for the user to enter their email address in this form.

The next line will be the submit button:

And the last line in the form will be the tag

Now let's put it all together.





Now let's make the fields in the form mandatory. We have the following code:





Create a file that accepts data from an HTML form

This will be a file called send.php

In the file, at the first stage, you need to receive data from the post array. To do this, we create two variables:

$fio = $_POST["fio"];
$email = $_POST["email"];

Variable names in php are preceded by a $ sign, and a semicolon is placed at the end of each line. $_POST is an array to which the data from the form is passed. In the html form, the send method method="post" is specified. So, two variables are taken from the html form. For the purposes of protecting your site, you need to pass these variables through several filters - php functions.

The first function will convert all characters that the user will try to add to the form:

In this case, new variables in php are not created, but existing ones are used. What the filter will do is convert the character "<" в "<". Также он поступить с другими символами, встречающимися в html коде.

The second function decodes the url if the user tries to add it to the form.

$fio = urldecode($fio);
$email = urldecode($email);

With the third function, we will remove spaces from the beginning and end of the string, if any:

$fio = trim($fio);
$email = trim($email);

There are other functions that allow you to filter php variables. Their use depends on how much you are afraid that an attacker will try to add program code to this form of sending data to html mail.

Validate data passed from HTML form to PHP file

In order to check if this code works, if the data is being transferred, you can simply display it on the screen using the echo function:

echo $fio;
echo "
";
echo $fio;

The second line here is needed in order to separate the output of php variables into different lines.

Sending the received data from the HTML form to the mail using PHP

To send data to the mail, you need to use the mail function in PHP.

mail("to which address to send", "the subject of the letter", "Message (body of the letter)","From: from which email the letter is sent \r\n");

For example, you need to send data to the email of the site owner or manager [email protected]

The subject of the email should be clear, and the message of the email should contain what the user has specified in the HTML form.

mail(" [email protected]", "Application from the site", "Name:".$fio.". Email: ".$email ,"From: [email protected]\r\n");

You need to add a condition that will check if the form was sent using PHP to the specified email address.

if (mail(" [email protected]", "Order from the site", "Name:".$fio.". Email: ".$email ,"From: [email protected]\r\n"))
{
echo "message sent successfully";
) else (
}

Thus, the program code of the send.php file, which will send the HTML form data to the mail, will look like this:

$fio = $_POST["fio"];
$email = $_POST["email"];
$fio = htmlspecialchars($fio);
$email = htmlspecialchars($email);
$fio = urldecode($fio);
$email = urldecode($email);
$fio = trim($fio);
$email = trim($email);
//echo $fio;
// echo "
";
//echo $email;
if (mail(" [email protected]", "Application from the site", "Name:".$fio.". Email: ".$email ,"From: [email protected]\r\n"))
( echo "message sent successfully";
) else (
echo "errors occurred while sending the message";
}?>

The three lines to check if data is being passed to the file are commented out. If necessary, they can be removed, since they were only needed for debugging.

Place HTML and PHP form submission code in one file

In the comments to this article, many people ask how to make both the HTML form and the PHP code for sending data to the mail in one file, not two.

To implement this work, you need to place the HTML code of the form in the send.php file and add a condition that will check for the presence of variables in the POST array (this array is passed from the form). That is, if the variables in the array do not exist, then you need to show the user a form. Otherwise, you need to take the data from the array and send it to the addressee.

Let's see how to change PHP code in send.php file:



Website application form


//check if variables exist in POST array
if(!isset($_POST["fio"]) and !isset($_POST["email"]))(
?>





) else (
//show the form
$fio = $_POST["fio"];
$email = $_POST["email"];
$fio = htmlspecialchars($fio);
$email = htmlspecialchars($email);
$fio = urldecode($fio);
$email = urldecode($email);
$fio = trim($fio);
$email = trim($email);
if (mail(" [email protected]", "Application from the site", "Name:".$fio.". Email: ".$email ,"From: [email protected]\r\n"))(
echo "Message sent successfully";
) else (
echo "Errors occurred while sending the message";
}
}
?>

We check the existence of a variable in the POST array with the PHP isset() function. An exclamation point before this function in a condition means negation. That is, if the variable does not exist, then we need to show our form. If I didn't put an exclamation mark, then the condition would literally mean - "if exists, then show the form". And this is wrong in our case. Naturally, you can rename it to index.php. If you rename the file, then do not forget to rename the file name and in the line

. The form must link to the same page, such as index.php. I added the page title to the code.

Common errors that occur when submitting a PHP form from a website

The first, probably the most popular mistake, is when you see a blank white page with no messages. This means that you made a mistake in the page code. You need to turn on the display of all errors in PHP and then you will see where the error was made. Add to code:

ini_set("display_errors","On");
error_reporting("E_ALL");

The send.php file must only be run on the server, otherwise the code simply won't work. It is desirable that this is not a local server, as it is not always configured to send data to an external mail server. If you run the code on a server other than the server, then you will see the PHP code right on the page.

Thus, for correct work, I recommend placing the send.php file on the hosting of the site. There, as a rule, everything is already configured.

Another common mistake is when the notification "Message sent successfully" appears, but the letter does not arrive in the mail. In this case, you need to carefully check the line:

if (mail(" [email protected]", "Order from the site", "Name:".$fio.". Email: ".$email ,"From: [email protected]\r\n"))

Instead of [email protected] should be an email address to which you want to send a letter, but instead of[email protected] must be an existing email for this site. For example, for a site site, this would be . Only in this case the letter with the data from the form will be sent.

© 2022 hecc.ru - Computer technology news