jasonc Posted July 30, 2008 Share Posted July 30, 2008 i desperately need an alternative to the PHP mail() command, my host keeps on disabling the nobody@ feature on the servers and this means no one gets emails with signup details or lost passwords reset requests!! is there another way surely there must be another way that does not require the mail() command? please advise thanks in advance for your help Quote Link to comment https://forums.phpfreaks.com/topic/117435-alternative-to-mail/ Share on other sites More sharing options...
Nhoj Posted July 31, 2008 Share Posted July 31, 2008 You could look into phpMailer, it's a library of sorts that allows you to use send mail using SMTP. http://phpmailer.codeworxtech.com/ Quote Link to comment https://forums.phpfreaks.com/topic/117435-alternative-to-mail/#findComment-604102 Share on other sites More sharing options...
ShaunO Posted July 31, 2008 Share Posted July 31, 2008 I don't think there is anything you can do. It is up to the server administrator to configure PHP to send email as your user. Quote Link to comment https://forums.phpfreaks.com/topic/117435-alternative-to-mail/#findComment-604138 Share on other sites More sharing options...
sKunKbad Posted July 31, 2008 Share Posted July 31, 2008 Have you tried the -f option? I've had this work for me in the past. This is straight from php.net: additional_parameters (optional) The additional_parameters parameter can be used to pass an additional parameter to the program configured to use when sending mail using the sendmail_path configuration setting. For example, this can be used to set the envelope sender address when using sendmail with the -f sendmail option. The user that the webserver runs as should be added as a trusted user to the sendmail configuration to prevent a 'X-Warning' header from being added to the message when the envelope sender (-f) is set using this method. For sendmail users, this file is /etc/mail/trusted-users. Quote Link to comment https://forums.phpfreaks.com/topic/117435-alternative-to-mail/#findComment-604241 Share on other sites More sharing options...
Third_Degree Posted July 31, 2008 Share Posted July 31, 2008 <?php $smtp = fsockopen( 'smtp.mail.com', 25, $no, $str, 5 ); fwrite( $smtp, "MAIL FROM: <email@domain.com>\r\n" ) or die( fread( $smtp, 10000 ) ); fwrite( $smtp, "RCPT TO: <email@domain.com>\r\n" ) or die( fread( $smtp, 10000 ) ); fwrite( $smtp, "DATA\r\n" ) or die( fread( $smtp, 10000 ) ); fwrite( $smtp, "Subject: Hello\r\n" ) or die( fread( $smtp, 10000 ) ); fwrite( $smtp, "Subject: email@domain.com\r\n" ) or die( fread( $smtp, 10000 ) ); fwrite( $smtp, "MIME-Version: 1.0\r\n\r\n" ) or die( fread( $smtp, 10000 ) ); fwrite( $smtp, "Body Text Here\r\n" ) or die( fread( $smtp, 10000 ) ); fwrite( $smtp, ".\r\n" ) or die( fread( $smtp, 10000 ) ); fwrite( $smtp, "QUIT\r\n" ) or die( fread( $smtp, 10000 ) ); ?> Screw PHPMailer... Quote Link to comment https://forums.phpfreaks.com/topic/117435-alternative-to-mail/#findComment-604266 Share on other sites More sharing options...
cooldude832 Posted July 31, 2008 Share Posted July 31, 2008 The PEAR extension libray offers solutions A very painful alternative is the IMAP library which is not very will documented. I have used it with limited success in the past, but you are really on your own for most of it since php.net and the web have very few and weak tutorials. Quote Link to comment https://forums.phpfreaks.com/topic/117435-alternative-to-mail/#findComment-604270 Share on other sites More sharing options...
jasonc Posted July 31, 2008 Author Share Posted July 31, 2008 You could look into phpMailer, it's a library of sorts that allows you to use send mail using SMTP. http://phpmailer.codeworxtech.com/ thanks i have been already been told to use this and did set it up but this uses the mail() command itself ! Quote Link to comment https://forums.phpfreaks.com/topic/117435-alternative-to-mail/#findComment-604291 Share on other sites More sharing options...
PFMaBiSmAd Posted July 31, 2008 Share Posted July 31, 2008 All methods (including mail(), phpmailer class, fsockopen()) at some point connect to the sending mail server and the information they provide must satisfy what the sending mail server is configured to accept and for a receiving mail server to accept any email, the email must satisfy what the receiving mail server is configured to accept. If you are attempting to leave off a From: address or use a nonexistent address nobody@yourdomain.com, then you are going to need to setup an actual mail box on the sending mail server to use in the From: address. Quote Link to comment https://forums.phpfreaks.com/topic/117435-alternative-to-mail/#findComment-604603 Share on other sites More sharing options...
sKunKbad Posted July 31, 2008 Share Posted July 31, 2008 i desperately need an alternative to the PHP mail() command, my host keeps on disabling the nobody@ feature on the servers and this means no one gets emails with signup details or lost passwords reset requests!! Finding a good host is not easy, because every one of them seems to have issues, but if this is a big issue to you, I'd think it might be easier to just move to another host. Also, if you call the host and tell them you are thinking about leaving because of this issue, they may be able to move you to a server that is managed differently. I did this with the host I use. When I signed up for an account, they said that sendmail wasn't available, but I had a choice to move to a different server that had sendmail enabled if I really needed to. I don't really need sendmail, but it's just so easy that I made sure they put me on the sendmail enabled server. Quote Link to comment https://forums.phpfreaks.com/topic/117435-alternative-to-mail/#findComment-604680 Share on other sites More sharing options...
jasonc Posted July 31, 2008 Author Share Posted July 31, 2008 All methods (including mail(), phpmailer class, fsockopen()) at some point connect to the sending mail server and the information they provide must satisfy what the sending mail server is configured to accept and for a receiving mail server to accept any email, the email must satisfy what the receiving mail server is configured to accept. If you are attempting to leave off a From: address or use a nonexistent address nobody@yourdomain.com, then you are going to need to setup an actual mail box on the sending mail server to use in the From: address. oh i use the from field? and the email address in the from exists. i have been told i should also check out 'Zend_Mail' any views on this ? Quote Link to comment https://forums.phpfreaks.com/topic/117435-alternative-to-mail/#findComment-604792 Share on other sites More sharing options...
sKunKbad Posted July 31, 2008 Share Posted July 31, 2008 I think you need to try the -f option. I had mentioned this earlier: <?php mail('nobody@example.com', 'the subject', 'the message', null, '-fwebmaster@example.com'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/117435-alternative-to-mail/#findComment-604855 Share on other sites More sharing options...
PFMaBiSmAd Posted July 31, 2008 Share Posted July 31, 2008 All the various mailer classes and frameworks do the same thing, but with different features and functions built in. If you are doing something fundamentally wrong for your mail server, you can try them all and they are not going to solve anything. Until you describe what the problem is and provide details about what you are doing that does not work, you are not going to get a solution. Quote Link to comment https://forums.phpfreaks.com/topic/117435-alternative-to-mail/#findComment-604952 Share on other sites More sharing options...
Third_Degree Posted August 1, 2008 Share Posted August 1, 2008 All methods (including mail(), phpmailer class, fsockopen()) at some point connect to the sending mail server and the information they provide must satisfy what the sending mail server is configured to accept and for a receiving mail server to accept any email, the email must satisfy what the receiving mail server is configured to accept. If you are attempting to leave off a From: address or use a nonexistent address nobody@yourdomain.com, then you are going to need to setup an actual mail box on the sending mail server to use in the From: address. The host has no control of a remote mail server...don't exactly know what you're saying. I still think fsockopen is the way to go, had to do something similar to this with another guy's server that didn't have the mail function or imap_ library and fsockopen worked. Quote Link to comment https://forums.phpfreaks.com/topic/117435-alternative-to-mail/#findComment-605294 Share on other sites More sharing options...
PFMaBiSmAd Posted August 1, 2008 Share Posted August 1, 2008 Since the OP has not bothered to explain what exactly the problem is or show what he is doing, the problem could be at any point, including the receiving mail server discarding the email because of something like the From: email address containing a domain that does not match the sending mail server or some other misuse or malformed aspect to the email. The various mailer classes use fsockopen() and exchange SMTP commands directly with the mail server when they are configured to use an smtp mail server. Quote Link to comment https://forums.phpfreaks.com/topic/117435-alternative-to-mail/#findComment-605299 Share on other sites More sharing options...
Third_Degree Posted August 1, 2008 Share Posted August 1, 2008 Since the OP has not bothered to explain what exactly the problem is or show what he is doing, the problem could be at any point, including the receiving mail server discarding the email because of something like the From: email address containing a domain that does not match the sending mail server or some other misuse or malformed aspect to the email. The various mailer classes use fsockopen() and exchange SMTP commands directly with the mail server when they are configured to use an smtp mail server. Fair enough. Quote Link to comment https://forums.phpfreaks.com/topic/117435-alternative-to-mail/#findComment-605307 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.