How to create an email box in my domain

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Emeka
    New Member
    • Dec 2009
    • 12

    How to create an email box in my domain

    Hello,

    Please how can I set up an email box in my domain. I have the php code and wish to create an email address as a recipient. The attached is the php codes I intend to use.

    Thanks

    Emeka
    Attached Files
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    do you want to send or receive emails via your server? for the latter you explicitly require a mail server, while sending only requires a mail script.

    PS. sending emails is more comfortable, if you use a mail library, like Swiftmailer.

    Comment

    • Emeka
      New Member
      • Dec 2009
      • 12

      #3
      Thanks. My domain has the following features; MySQL sever under the admistration of phpMyAdim and java codes. The POP email server is ****. The previous attachment is the php codes I intend to use. Please I need some clues on how to create an exprimental email box in my domain to send and receive emails in my server. Can you please edit the source code.
      Last edited by Dormilich; Dec 26 '09, 04:10 PM. Reason: minor corrections

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        Can you please edit the source code.
        no.

        because I'd make that in a totally different way.

        to get email from the server, I'd always use an email client (thunderbird, eudora, sylpheed, etc.), same goes for when I want to write an email myself. It needs special circumstances to use a web frontent for the mail server (form processing, blog comment notification ...).

        Comment

        • Emeka
          New Member
          • Dec 2009
          • 12

          #5
          OK. Please is there any way you can help? I joined this IT group to gain practical advice from experts like you in php programs.

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            Please is there any way you can help?
            I hope so.

            first thing you have to do is figure out, what you want to do exactly. (as I said, using mail clients can prevent many problems).

            once you know what you have to do with a web form, you need to design the web interface (HTML/CSS/JavaScript). then you have to think, what the PHP code should do. you need a way to sanitize user input and so on.

            rule of thumb: there is no need to reinvent the wheel.

            I hope this helps at least a little

            this is my current newsletter script (only top level shown). please note that this script (though looking rather simple) requires two additional classes and the aforementioned SwiftMailer library.
            Code:
            function sendMail()
            {
            	// since the user input comes from a restricted place,
            	// the usual input validation is omitted
            	$text    = $_POST["NLG"];
            	$betreff = $_POST["betreff"];
            
            	// send mail only, if every required field was filled
            	if (!$text or !$betreff) 
            	{
            		echo '<p>Bitte alle Felder ausf&uuml;llen!</p>';
            		return false;
            	}
                    
            	// preparing auto text (mail footer)
            	$msg = "Liebe(r) {name},\n\n" . $text . "\n_______________\n\nZum Abmelden klicken Sie auf: http://www.example.org/abmeldung.php?uid={UID}\noder rufen Sie diese Adresse im Browser auf.";
            
            	// send mails to every recipient from the DB
            	// thrown Exceptions are caught somewhere else
            	$RS = new BatchMail($msg, $betreff); 
            	$RS->setTo(getMailAdresses());
            	$RS->send();
            	saveMail($text);
            	// print mail success 
            	echo $RS;
            }

            Comment

            • Emeka
              New Member
              • Dec 2009
              • 12

              #7
              Thanks alot. I am aware that html, css and javaScript will be involved. I just want to expriment on creating a form on web through which mails can be sent to my domain. Already I have created a mail box with the domain's name. One more question please, how can I link the code to my domain?
              Last edited by Dormilich; Dec 26 '09, 07:11 PM. Reason: removed email address for your own safety

              Comment

              • Dormilich
                Recognized Expert Expert
                • Aug 2008
                • 8694

                #8
                how can I link the code to my domain?
                which code?

                Comment

                • Emeka
                  New Member
                  • Dec 2009
                  • 12

                  #9
                  Ok thanks. I have little knowledge in php and wish to improve by practise and asking question. I mean is there any configuration between the php code and my domain? I have created an email box with my domain's name.

                  Comment

                  • Dormilich
                    Recognized Expert Expert
                    • Aug 2008
                    • 8694

                    #10
                    well, that depends on what code you use. PHP's mail() function does not use SMTP, but if you wish to use SwiftMailer, check out it's excellent documentation (set the SMTP host in Swift_SmtpTrans port)

                    Comment

                    • Emeka
                      New Member
                      • Dec 2009
                      • 12

                      #11
                      Please I am somehow confused. Please explain. The code I intend to use is PHP code. Which one will I use since PHP codes do not use SMTP?

                      Comment

                      • Dormilich
                        Recognized Expert Expert
                        • Aug 2008
                        • 8694

                        #12
                        The code I intend to use is PHP code.
                        PHP code is able to use SMTP. it is only a question, which one*.
                        Alas, if you mean your PHP code, all you need to know is in the PHP manual (ref. mail())

                        (As I mentioned, using an email library (which is also PHP code) allows you to use email via SMTP.)

                        I still recommend using an email library. much easier if it comes to HTML mail and attachments

                        * it most probably requires the use of sockets

                        Comment

                        • Emeka
                          New Member
                          • Dec 2009
                          • 12

                          #13
                          Very sorry I have to go to bed after waiting for your reply. I want to have knowledge of both, the use of email library and PHP code. Please give me an example of email library and sockets (for PHP code).

                          Comment

                          • Dormilich
                            Recognized Expert Expert
                            • Aug 2008
                            • 8694

                            #14
                            Very sorry I have to go to bed after waiting for your reply.
                            I have been busy with Phileasson.

                            I want to have knowledge of both, the use of email library and PHP code.
                            there is no difference between them, since the library is PHP code.

                            Please give me an example of email library and sockets (for PHP code).
                            see my demo example.
                            don't bother with sockets (yet), that's advanced PHP. the library will do that and all other necessary things for you.

                            Comment

                            • Emeka
                              New Member
                              • Dec 2009
                              • 12

                              #15
                              Ok I will give it a trial and give you feedback. What i really want to expriment on is a form on the web designed with PHP used to send and recieve email messages. Already I have designed a skeletal form, email box from my domain where the messages will be sent to. I will use your above demo example as design engine that will connect the front-end with the back-end.

                              Comment

                              Working...