S
S
sorry_i_noob2018-10-18 17:16:00
PHPMailer
sorry_i_noob, 2018-10-18 17:16:00

I sent emails with gmail and they came through fine. Now I tried to send from the hosting mail - they end up in spam. Can this be fixed?

Hello. What determines whether the letter gets into spam or not? From the server? For example, smtp.gmail.com, smtp.beget.com. Or from some settings in the PHPMailer class, for example? That is, the settings that I can change are Port or SMTPSecure.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
B
Barmunk, 2018-10-18
@Barmunk

You need a correct PTR, you need a DKIM record, ip in spam lists, etc.
Try to check through this service:
www.mail-tester.com

H
heartdevil, 2015-08-03
@heartdevil

I think if you didn’t understand anything from the task, then the topic was not mastered.

You are right, of course. BUT, if you really decide to learn how to program, then you will have to get used to this feeling and work on yourself further. Because such misunderstandings will arise sooo often. If you haven’t understood something yet, then you haven’t grown up yet (here you need to understand correctly). Do not despair. Keep working. This is not an equation or a problem, where without knowing one thing is unknown, it is impossible to solve the problem. You will have a space at this point, but you can still program. And when you stumble upon a task where you need to understand closures, then you will have a real motivation for this.
Of course, there are people who have a phenomenal memory and an excellent thinker, but there are only a few of them. They are able to read the introductory course, immediately cool programming. But the rest of the mass just also stumbles upon the same problems as you. And there is nothing to worry about if you do not understand something.

A
Alexander Taratin, 2015-08-03
@Taraflex

IMHO. A simple solution should look like this

function makeArmy() {
    
      var shooters = [];
    
      for (var i = 0; i < 10; i++) {
        var shooter = function(self_i) { // функция-стрелок
          alert( self_i ); // выводит свой номер
        };
        shooter = shooter.bind(null, i);
        shooters.push(shooter);
      }
    
      return shooters;
}
    
var army = makeArmy();

shooter = shooter.bind(null, i);
The bind method available for functions, if explained in simple terms, returns a new function, which is the original function with a glued context ( this inside the function) - the first parameter (in this case, null), and call arguments - all subsequent arguments (we only have i)
That is, shooter.bind(null, i) will return a function that will perform the same actions as the original shooter, but as if we passed i as the first parameter.

V
Vitaly Inchin ☢, 2015-08-03
@In4in

Did you not understand the solution or the cause of the error? Or both?
The function does not take i when creating, does not save it somewhere, it will take it exactly when it is executed, i.e. after the loop, when i will be = 10.
If you chew on "corrections", then something like this:
1- First: A function is an object, and like any object, it can be assigned a property, which is what they do. Then from the function itself they get access to it.
2nd : Pass i to the inner function and return the desired function through it, which takes i (i.e. x) from the context of the first one and therefore, it retains the value after changing the global i.
3rd: The essence is the same as in the second, but the push is performed in the context of the first function (this does not change anything). In other words, they recorded it more beautifully, the essence has not changed.
And in a more understandable language only in books, not in online directories.

A
Anatoly Sidorov, 2015-08-03
@sidan

For all arrows, the call will return 10, because at the time of the call (and not creation), the function will refer to i = 10 (to the last iteration). In order to save the value of a variable, you need to save it to a local one. For example like this:

function makeArmy() {

  var shooters = [];

  for (var i = 0; i < 10; i++) {
    var shooter = (function() { // функция-стрелок
    var j = i; //сохраняем значение в локальную переменную
    return function() {          
      alert( j ); // выводит свой номер
    }
    })();
    shooters.push(shooter);
  }

  return shooters;
}

var army = makeArmy();

Here habrahabr.ru/post/38642 completely describes your problem and its solution.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question