• Resolved John

    (@dsl225)


    Hello,

    Is there a way to use SMTP or PHPMailer() with this wonderful plugin?
    Maybe in conjunction with another plugin?

    I moved server and the new one is blocking PHP’s mail() feature (sendmail) and I would like to keep this plugin running as it’s really simple and straight forward.

    Thanks.

Viewing 15 replies - 1 through 15 (of 38 total)
  • Plugin Author Guido

    (@guido07111975)

    Hi John,

    I have 1 site using the Gmail SMTP plugin and it works… because that plugin hooks into the native wp_mail function (which VSCF uses to send submissions).

    If you’re not using Gmail, you can also try this one (not tested yet).

    Guido

    Thread Starter John

    (@dsl225)

    Thanks Guido,

    Unfortunately this particular site is not using Gmail but I’ll keep this reference for further sites.

    I also tested with WP Mail SMTP by WPForms but it didn’t work.

    Just curious: why aren’t you using PHPMailer()? It seems many hosting companies are now blocking PHP’s mail() – at least as far as I understand…

    It was also not working for me. In my case I change the From header with a email of my domain and its start working.

    Plugin Author Guido

    (@guido07111975)

    Hi,

    John – wp_mail is a native WordPress function and DOES use phpmailer, please check this link.

    Sanjay – thanks for your solution in your other topic regarding the From header. I will try this myself and if it works here too I will update plugin asap. In that case it should work with the SMTP plugin mentioned before…

    Guido

    • This reply was modified 7 years, 4 months ago by Guido.
    Thread Starter John

    (@dsl225)

    Thanks again Guido,

    I don’t want to abuse your knowledge and time but I’m a bit confused here.

    When I had this issue at new hosting, I sent them this sentence from your FAQ:
    Form submissions are send using the wp_mail function (similar to php mail function). Maybe your hostingprovider disabled the php mail function, ask them to enable it.

    They replied the following:
    PHP’s mail() feature (sendmail) is prohibited on our nodes due to the abuse risk it presents, especially with such easily compromised platforms like WordPress. Please use local SMTP over port 25 for sending mail.
    Also, any plugin that uses PHPMailer() instead of mail() should work for you.

    I know and well understand how SMTP works but I’m really confused with those statements:
    wp_mail function (similar to php mail function)
    PHP’s mail() feature (sendmail)
    PHPMailer() instead of mail()

    What are the differences, if I may ask, between wp_mail, php mail, sendmail and PHPmailer?

    Hello John,
    Guido is correct
    I will try to explain ( though I am not better in it ?? )

    1. PHP’s mail() feature(sendmail) is a basic feature in built in PHP. So anyone who knows PHP can write simple php script to send emails. If server (hosting) does not disable it than any PHP script having this function can send email by just writing simple line of codes.

    2. PHPMailer() is a class or (small library) written in PHP (Link) Which allow you to send emails more efficiently. It also uses the same PHP built in function mentioned above to send emails by default. But it has also very powerful SMTP methods to send emails. So basically it has multiple methods of sending emails and more efficiently.

    3. wp_mail is wordpress function which is built on the top of PHPMailer() class to send emails. So basically wp_mail uses PHPMailer which in its core uses mail(sendmail) function of built in PHP function as one of its option.

    wp_mail uses PHPMailer default, which is mail() function as I said above.

    If your server has disabled the mail() function of PHP, than neither PHPMailer() class nor wp_mail function can send emails. You have to use SMTP in that case.

    • This reply was modified 7 years, 4 months ago by sanjayojha.
    Thread Starter John

    (@dsl225)

    Many thanks Sanjay, that’s awesome!

    But still not very clear for me and I’m a bit lost in there.
    I understand SMTP is better but when reading your last paragraph I still don’t understand why my host wrote this:
    Also, any plugin that uses PHPMailer() instead of mail() should work for you.

    For the time being, if I don’t want to use SMTP, the only plugin that works with this server is Contact Form 7 but I don’t really know why…

    Also, any plugin that uses PHPMailer() instead of mail() should work for you.

    PHPMailer is popular for sending emails via SMTP methods, not its default mailer function (Which wp_mail uses). So your host think that if a plugin is using PHPMailer() that mean it is using SMTP.

    I Think, the problem is with the form headers. Different plugins set it different. As I suggested in the first post of this thread, try to change the header value of From in Guido plugin code ( it should be an email from your domain, something like, [email protected], where yourwebsite is your domain name )
    See this code on line number 129 in vscf-form.php, $headers .= "From: ".$form_data['form_name']." <".$form_data['form_email'].">" . "\r\n";
    Change it to something like this
    $headers .= "From: noreply <[email protected]>" . "\r\n";

    Though, I am not 100% sure if this is going to solve your problem.

    Thread Starter John

    (@dsl225)

    Thanks again Sanjay, this becomes clearer now.

    I’ll wait until Guido tests this and see if he implements the change in an update.
    But what you state about the HEADER makes sense as this is what I read everywhere about people having problems sending mails with other plugins. Also Contact Form 7 requires this setting (the sites domain) in the FROM field.

    But I don’t well understand what sort of magic operates and you get your visitor’s address when replying to his message – instead of the one you used in the FROM field…

    One more question for you: when you use a FROM email address with your site’s domain, do you also need to create this email account in cPanel? I believe not but wanted to be sure about that.

    I am glad its clear for you now,

    Here is my best explanation of your 2 questions
    1. Its another header of the form, known as Reply-To. Most of the good plugin like Contact Form 7 and Guido plugin add this in their script along with From header I explained above. When Reply-To is present in header of received email then replying to it will go to the Reply-To email address, when it is not present it will take email from FROM header.
    Hope the magic is clear now ??

    2. In most of the cases it is not required. But I have encountered some server which demand it. So if your server is very strict than chances are you need to make that email address. But to my coding life, I have encountered only 2 occasions where it was necessary.

    Thread Starter John

    (@dsl225)

    Wonderful, everything is clear now!
    That was a great tutorial, thanks again!

    Plugin Author Guido

    (@guido07111975)

    Hi John and Sanjay,

    Have just updated plugin but made a mistake: changed From header into email from admin (set in Settings > General), but it’s much better to use an email that always ends with the domain of the site.

    But what’s the best way to get an email that ends with the domain of the site?! In codex it’s done like this.. but I’m trying to find another way.. I will keep you informed.

    Guido

    Plugin Author Guido

    (@guido07111975)

    made a mistake: changed From header into email from admin

    Not a mistake, as long as you use an email that ends with the domain of the site.

    Checked Contact form 7… it works the same way there, check this link.

    Guido

    Hello Guido,

    Nice work in updating plugin, I think its good approach. However, I suggest to provide a setting in admin area for this in your future updates, becasue not everyone wants to use their admin email.

    Thread Starter John

    (@dsl225)

    Also agree with Sanjay: should be a setting (or shortcode) that allows users to enter their own email that matches their domain.

    And Contact Form 7 works also rather that way: you are able to define your own custom FROM email address and it doesn’t automatically use the admin email address. In fact, it “suggests” the FROM to be “[email protected]” but you may edit this as you want, as long as it is an address with same domain as the site.

    Because the admin email addresses in WP settings are rarely those of the site’s domain and people prefer using rather their own address (like gmail).

    • This reply was modified 7 years, 4 months ago by John.
Viewing 15 replies - 1 through 15 (of 38 total)
  • The topic ‘SMTP?’ is closed to new replies.