rohitbanerjee Posted March 13, 2012 Share Posted March 13, 2012 Hello, New to this forum so appreciate the patience and apologize for any breaking of etiquette. I currently have a PHP script which generates the appropriate HTML headers and body packet and would like to place it in either a Thunderbird outbox so that Thunderbird will handle sending it or put it in the Evolution outbox so Evolution will handle the actual sending of the e-mail. I've scoured the internet looking for an answer and I know it is possible because I wrote a bash script to do it a few years back that I can't find. Would appreciate any insight. Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/258782-sending-html-e-mails-generated-in-php-through-thunderbirdevolution/ Share on other sites More sharing options...
xyph Posted March 13, 2012 Share Posted March 13, 2012 You'd need to create some sort of command-line program to do this for you, and call it through PHP. This will probably be OS-specific. This is a VERY odd way to handle this sort of thing. Why are you approaching it this way? Quote Link to comment https://forums.phpfreaks.com/topic/258782-sending-html-e-mails-generated-in-php-through-thunderbirdevolution/#findComment-1326637 Share on other sites More sharing options...
rohitbanerjee Posted March 13, 2012 Author Share Posted March 13, 2012 I have to be honest, this is a very noobish problem but my generic PHP mail function does not seem to be working. I just cut and paste some example code and the mail() function seems to stall for about 60 seconds and then returns true but the mail does not get delivered. I figured a quick and easy hack would be to construct the html email, drop it in a mail client's (like Thunderbird or Evolution) outbox and let the commercial app send the email. Quote Link to comment https://forums.phpfreaks.com/topic/258782-sending-html-e-mails-generated-in-php-through-thunderbirdevolution/#findComment-1326639 Share on other sites More sharing options...
xyph Posted March 13, 2012 Share Posted March 13, 2012 Is this for your own development/testing server, or something in full production? What operating system is the server running on? I'd very strongly suggest against fixing this issue the way you planned. Quote Link to comment https://forums.phpfreaks.com/topic/258782-sending-html-e-mails-generated-in-php-through-thunderbirdevolution/#findComment-1326641 Share on other sites More sharing options...
rohitbanerjee Posted March 13, 2012 Author Share Posted March 13, 2012 The fundamental problem is that I have a godaddy hosted email account, let's call it [email protected]. I would like to write a script which sends emails as [email protected]. To accomplish this, I modified my php.ini file to the following: SMTP = smtpout.secureserver.net sendmail_path = "/usr/sbin/sendmail -t" When I call the mail() function, it returns True but does not deliver the email. I was able to link [email protected] with Thunderbird and Evolution and I figured that if I could find an easy way to drop the constructed email messages into the outboxes, every time the app refreshed internally, my mails would get sent out. I am running Linux Ubuntu 10.04. Quote Link to comment https://forums.phpfreaks.com/topic/258782-sending-html-e-mails-generated-in-php-through-thunderbirdevolution/#findComment-1326677 Share on other sites More sharing options...
xyph Posted March 13, 2012 Share Posted March 13, 2012 Is your web server also on GoDaddy? Quote Link to comment https://forums.phpfreaks.com/topic/258782-sending-html-e-mails-generated-in-php-through-thunderbirdevolution/#findComment-1326717 Share on other sites More sharing options...
rohitbanerjee Posted March 13, 2012 Author Share Posted March 13, 2012 Yes Quote Link to comment https://forums.phpfreaks.com/topic/258782-sending-html-e-mails-generated-in-php-through-thunderbirdevolution/#findComment-1326790 Share on other sites More sharing options...
rohitbanerjee Posted March 13, 2012 Author Share Posted March 13, 2012 Suppose I want to just send mails from my home machine -- what modifications do I have to make to my php.ini file. Do I have to have a web server running at home? If so, what's the simplest way to set it up? Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/258782-sending-html-e-mails-generated-in-php-through-thunderbirdevolution/#findComment-1326807 Share on other sites More sharing options...
Muddy_Funster Posted March 13, 2012 Share Posted March 13, 2012 You likely need to authenticate with the SMTP server in order to send the mails, unless you are using linux then php mail() and sendmail() won't pass SMTP authentication information. you would need to use something else (or set up a linux VM) that said your hosted site should be linux and as such if you set the authentication settings in that it should work. Quote Link to comment https://forums.phpfreaks.com/topic/258782-sending-html-e-mails-generated-in-php-through-thunderbirdevolution/#findComment-1326834 Share on other sites More sharing options...
rohitbanerjee Posted March 13, 2012 Author Share Posted March 13, 2012 Hey Muddy, I am working in a Linux distro (Ubuntu 10.04) and my GoDaddy account is in a Linux Hosting environment as well. Any advice on how to set that up? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/258782-sending-html-e-mails-generated-in-php-through-thunderbirdevolution/#findComment-1326844 Share on other sites More sharing options...
Muddy_Funster Posted March 13, 2012 Share Posted March 13, 2012 sadly not, I run a WAMP environment, google "sendmail SMTP auth settings" should do it for you though, or someone else who does know may post up what you need. I had to resort to the PEAR Net_SMTP class to get my mails to pass through a verified SMTP account, that was a pain in the ass. Quote Link to comment https://forums.phpfreaks.com/topic/258782-sending-html-e-mails-generated-in-php-through-thunderbirdevolution/#findComment-1326860 Share on other sites More sharing options...
Vel Posted March 13, 2012 Share Posted March 13, 2012 Check out something like this - http://www.kidmoses.com/blog-article.php?bid=56 Quote Link to comment https://forums.phpfreaks.com/topic/258782-sending-html-e-mails-generated-in-php-through-thunderbirdevolution/#findComment-1327028 Share on other sites More sharing options...
trq Posted March 14, 2012 Share Posted March 14, 2012 If your developing on Linux just install the ssmtp package. It is a sendmail drop in replacement that is simple to configure and allows you to use a remote smtp server 9such as Gmail) to send mail. This is awesome for testing purposes. Quote Link to comment https://forums.phpfreaks.com/topic/258782-sending-html-e-mails-generated-in-php-through-thunderbirdevolution/#findComment-1327191 Share on other sites More sharing options...
rohitbanerjee Posted March 14, 2012 Author Share Posted March 14, 2012 I'll try out your suggestions -- thanks for all the feedback Quote Link to comment https://forums.phpfreaks.com/topic/258782-sending-html-e-mails-generated-in-php-through-thunderbirdevolution/#findComment-1327270 Share on other sites More sharing options...
rohitbanerjee Posted March 14, 2012 Author Share Posted March 14, 2012 So ssmpt works beautifully -- thanks for the suggestion. I am curious, I read the man page and it seems as though you have to enter messages via stdin. Is it possible to pass in the From, To, Subject, Body in a file or by printing it to stdin? I am also trying the PEAR-Mail package and running into a pretty basic error -- can't find Mail.php. The standard include paths are /usr/share/php and /usr/share/php/PEAR. I looked and Mail.php is not located there. I ran pear install Mail-1.2.0 successfully so not sure what the issue is. Anything simple I forgot? Quote Link to comment https://forums.phpfreaks.com/topic/258782-sending-html-e-mails-generated-in-php-through-thunderbirdevolution/#findComment-1327298 Share on other sites More sharing options...
Muddy_Funster Posted March 14, 2012 Share Posted March 14, 2012 are you including the mail.php at the top of your page? I only used the Net_SMTP and it had to be included before the class could be called try using : require_once 'Mail/mail.php'; Quote Link to comment https://forums.phpfreaks.com/topic/258782-sending-html-e-mails-generated-in-php-through-thunderbirdevolution/#findComment-1327308 Share on other sites More sharing options...
rohitbanerjee Posted March 14, 2012 Author Share Posted March 14, 2012 <?php require_once 'Mail/Mail.php'; $from = "[email protected]"; $to = "[email protected]"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; $host = "smtpout.secureserver.net:80"; $username = "[email protected]"; $password = "password"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Message successfully sent!</p>"); } ?> I ran pear install Net_SMTP and it is up to date (v1.6.1). I get the following error: Warning: require_once(Mail/Mail.php): failed to open stream: No such file or directory in /script_location/mail_test.php on line 2 PHP Fatal error: require_once(): Failed opening required 'Mail/Mail.php' (include_path='.:/usr/share/php:/usr/share/php/PEAR') in /script_location/mail_test.php on line 2 I have actually checked the include paths and there is no Mail.php or Mail directory. I uninstalled and re-installed Mail-1.2.0 as well as Net_SMTP and got the following output: downloading Mail-1.2.0.tgz ... Starting to download Mail-1.2.0.tgz (23,214 bytes) ........done: 23,214 bytes install ok: channel://pear.php.net/Mail-1.2.0 downloading Net_SMTP-1.6.1.tgz ... Starting to download Net_SMTP-1.6.1.tgz (13,164 bytes) .....done: 13,164 bytes install ok: channel://pear.php.net/Net_SMTP-1.6.1 Do I have to do anything else to "install" Mail? Thanks for any help Quote Link to comment https://forums.phpfreaks.com/topic/258782-sending-html-e-mails-generated-in-php-through-thunderbirdevolution/#findComment-1327385 Share on other sites More sharing options...
rohitbanerjee Posted March 14, 2012 Author Share Posted March 14, 2012 Never mind -- problem fixed, did a simple search and found it. Sorry for the noobishness and thanks a lot for any help. Quote Link to comment https://forums.phpfreaks.com/topic/258782-sending-html-e-mails-generated-in-php-through-thunderbirdevolution/#findComment-1327387 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.