469,365 Members | 1,769 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,365 developers. It's quick & easy.

How to create an email box in my domain

12
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
File Type: txt email.txt (884 Bytes, 359 views)
Dec 26 '09 #1

✓ answered by Dormilich

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.

21 3363
Dormilich
8,652 Expert Mod 8TB
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.
Dec 26 '09 #2
Emeka
12
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.
Dec 26 '09 #3
Dormilich
8,652 Expert Mod 8TB
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 ...).
Dec 26 '09 #4
Emeka
12
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.
Dec 26 '09 #5
Dormilich
8,652 Expert Mod 8TB
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.
Expand|Select|Wrap|Line Numbers
  1. function sendMail()
  2. {
  3.     // since the user input comes from a restricted place,
  4.     // the usual input validation is omitted
  5.     $text    = $_POST["NLG"];
  6.     $betreff = $_POST["betreff"];
  7.  
  8.     // send mail only, if every required field was filled
  9.     if (!$text or !$betreff) 
  10.     {
  11.         echo '<p>Bitte alle Felder ausf&uuml;llen!</p>';
  12.         return false;
  13.     }
  14.  
  15.     // preparing auto text (mail footer)
  16.     $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.";
  17.  
  18.     // send mails to every recipient from the DB
  19.     // thrown Exceptions are caught somewhere else
  20.     $RS = new BatchMail($msg, $betreff); 
  21.     $RS->setTo(getMailAdresses());
  22.     $RS->send();
  23.     saveMail($text);
  24.     // print mail success 
  25.     echo $RS;
  26. }
Dec 26 '09 #6
Emeka
12
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?
Dec 26 '09 #7
Dormilich
8,652 Expert Mod 8TB
how can I link the code to my domain?
which code?
Dec 26 '09 #8
Emeka
12
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.
Dec 26 '09 #9
Dormilich
8,652 Expert Mod 8TB
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_SmtpTransport)
Dec 26 '09 #10
Emeka
12
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?
Dec 26 '09 #11
Dormilich
8,652 Expert Mod 8TB
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
Dec 26 '09 #12
Emeka
12
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).
Dec 27 '09 #13
Dormilich
8,652 Expert Mod 8TB
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.
Dec 27 '09 #14
Emeka
12
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.
Dec 27 '09 #15
Dormilich
8,652 Expert Mod 8TB
first try just sending emails… receiving emails is a lot more complicated. and I still recommend to use an email client to receive emails.
I will use your above demo example as design engine
that demo is useless without the incorporated classes.
Dec 27 '09 #16
Emeka
12
Thanks. IF there is any further help you give, it will be highly appreciated. I have made my objectives known to you.
Dec 28 '09 #17
Dormilich
8,652 Expert Mod 8TB
IF there is any further help you give, it will be highly appreciated.
yea, for a first step get the email sending running.
Dec 28 '09 #18
Emeka
12
Hello Dormilich,

I have been able to use PHP code to receive mails. The difficulty I am having is to automate reply of letters from my mail box with the first PHP code you gave. How can I combine the receiving and sending PHP code. The code you gave to me was used for sending.
Jan 21 '10 #19
Dormilich
8,652 Expert Mod 8TB
How can I combine the receiving and sending PHP code. The code you gave to me was used for sending.
you’ll need a mail server to receive emails, while sending emails doesn’t.
Jan 21 '10 #20
Emeka
12
I have been able to receive mails. I want to apply auto-reply. Please how can I combine the PHP codes? HTML and CSS was use to design the web interface.
Jan 21 '10 #21
Dormilich
8,652 Expert Mod 8TB
besides a cron job, that regularly checks the mailbox, I have no other idea … maybe someone else knows better.
Jan 21 '10 #22

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Keith Jakobs, MCP | last post: by
4 posts views Thread by Ron Vecchi | last post: by
4 posts views Thread by anders | last post: by
2 posts views Thread by vbnetdev | last post: by
8 posts views Thread by Brady Love | last post: by
5 posts views Thread by Michael | last post: by
7 posts views Thread by tirrell payton | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.