Hi,
I am creating an application using php. I want to send a mail from my application with attachments. I get the from-address and to-address from the user at run time. Then, how i set the SMPT, port number and other details of the from-address in phpmailer class or smtp class. Please, Any one can help with any example code?

Recommended Answers

All 7 Replies

If you search this forum for "phpmailer" then you'll get lots of threads with examples.

I get the from-address and to-address from the user at run time of my application. I want to send mail from the given from-address to the given to-address. Then how I get the password of the from-address mailid? & How i define the port number, smtp, host in class.phpmailer.php?

Then how I get the password of the from-address mailid?

If you ask for the fromAddress, you'll need to ask the password too. Unless maybe if the mail server is on the same server as your website, and all users have an account on that server. If each user uses a different host, you may need to ask those too, or predefine all possibles as a setting. If this is not what you mean, please try to provide a better explanation.

In my project, I want to send some messages from one person to another person. It consists of from-address, to-address and message body with or without atttachments and send-mail button. If the user click the send-mail button, then I want to send that mail from specified from-address to the specified to-address through my application. This is my main concept. But I dont know whether it is possible or not. Is it possible or not? If possible means, Please tell, how can i get my solution?

Are all email addresses accounts on your own server?

No, It may be gmail/yahoo/webmail/or any. It is possible to do this?

If it can be any, you need all information. Not only email/password, but for every possible mail server also all data (server, port, encryption, etc). So it should be possible, but it requires a lot of testing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.