News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Sendmail with SMTP

Started by iViscosity, December 12, 2016, 12:01:09 AM

Previous topic - Next topic

iViscosity

So the host that I use, hxxp:nfoservers.com [nonactive], does not allow PHP scripts to send mail via their SMTP server, so I need to use sendmail to send the email. However, I have extremely limited knowledge on PHP and I have no idea how I'd set this up.  They send me an example:

Code (php) Select
<?php
// The message
$message "Line 1\r\nLine 2\r\nLine 3";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message wordwrap($message70"\r\n");

// Send
mail('[email protected]''My Subject'$message);
?>


in which the 'mail(...' was the local sendmail function, but I have no idea how I'd use this with SMF, and was hoping to see if anyone here could help me out with this. Sorry if this has been posted before, but my searches didn't find anything that I needed.

Also I found this function
Code (php) Select
function sendmail($to, $subject, $message, $from = null, $message_id = null, $send_html = false, $priority = 3, $hotmail_fix = null, $is_private = false) and I think I need to  use that somehow but I'm not sure how.

vbgamer45

For external SMF projects use phpmailer https://github.com/PHPMailer/PHPMailer

Otherwise in SMF use sendmail function
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

iViscosity

#2
Quote from: vbgamer45 on December 12, 2016, 08:45:43 AM
For external SMF projects use phpmailer hxxp:github.com/PHPMailer/PHPMailer [nonactive]

Otherwise in SMF use sendmail function

I'm sorry, not really sure what you're saying here. I know there is a 'sendmail' function, but how can I use that with SMTP?

I find this: // Use sendmail if it's set or if no SMTP server is set. but I'm not sure how to 'set' it to use sendmail, and I want to use it WITH an SMTP server. More specifically, hxxp:mail.nfoservers.com [nonactive].

EDIT: Never mind, just realized they don't allow automated messages VIA their SMTP, which registration emails are. If I set the mail setting to PHP Default, would it use the email from my Webmaster Email Address setting under Admin > Server Settings?

radu81

QuoteIf I set the mail setting to PHP Default, would it use the email from my Webmaster Email Address setting under Admin > Server Settings?
yes
sorry for my bad english

Advertisement: