Jump to content

Form to Mail


jalen

Recommended Posts

  • Replies 78
  • Created
  • Last Reply

Top Posters In This Topic

Well if you did that on purpose and WANT your email hardcoded there, then why did you turn around and post code putting $_POST there?  It makes me think you're either lying or don't know what you're talking about. 

 

Are you....

 

a) wanting to send it to the same email (your email) no matter what?

---> Assign your email address to $my_email like you claim you did (initially):

 

$my_email = "jalen@someplace.com"; // or wherever

 

b) wanting to send to whatever you specify in that first "Email address" input field in your form?

---> Assign it the posted var like I said (exactly like that, no changing anything):

 

$my_email = $_POST['my_email'];

 

 

Link to comment
Share on other sites

Are you....

 

a) wanting to send it to the same email (your email) no matter what?

---> Assign your email address to $my_email like you claim you did (initially):

 

$my_email = "jalen@someplace.com"; // or wherever

 

 

I want it like this, didn't know what you mean before.  But I wouldn't mind later on do it that way when I need to, good to know both. thanks. 

Link to comment
Share on other sites

what should I change this to?

 

Okay well this depends on your mail service provider,

You need to enter the details as if you was setting up the account on MacMail or Outlook

ie

heres some details i sent to a client, (edited a little)

Mail Server Email: jayne@mydomain.com

Mail Server Username: jayne+mydomain.com

Mail Server Password: Wdgffgh123sNt

Incoming Mail Server: mail.mydomain.com

Outgoing Mail Server: mail.mydomain.com (server requires authentication)

 

Now Outgoing Mail Server: mail.mydomain.com is would be used

ie

SMTP=mail.mydomain.com

 

the problem is mine require authentication password, so to save time i could use PHPMailer as mai() doesn't support authentication

Link to comment
Share on other sites

PFMaBiSmAd

 

now I only have this error:

 

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Apache\htdocs\FormToEmail.php on line 197

failed

Link to comment
Share on other sites

I have looked at the ports

http://www.hostmysite.com/support/email/telnet/

 

and with the sending test, I get a message similar to the correct one but the received one it totally failed

I even enable and open port 110 and that still failed. 

 

I still can't send mail to my email and still gets this error message:

 

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Apache\htdocs\FormToEmail.php on line 197

failed

 

any ideas?

Link to comment
Share on other sites

MadTechie

 

from what I know is that form to mail in local environment is more complicated than an internet hosting am I right?

and if I am, do you know how to get it to work on local environment.

 

if you can, walk me through each step on how to get it to work pls. thanks. 

Link to comment
Share on other sites

Download PHPMailer and create a gmail account and try the script below

 

<?php
require_once('../class.phpmailer.php');
$mail             = new PHPMailer();
$body             = "testing <b>PHP Mailer</b> wooohooo";

$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
                                           // 1 = errors and messages
                                           // 2 = messages only
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
$mail->Port       = 465;                   // set the SMTP port for the GMAIL server

//update
$mail->Username   = "yourusername@gmail.com";  // GMAIL username
$mail->Password   = "yourpassword";            // GMAIL password
$mail->SetFrom('yourusername@gmail.com', 'First Last');


$mail->Subject    = "PHPMailer Test Subject via smtp (Gmail), basic";

$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test

$mail->MsgHTML($body);

$address = "whoto@otherdomain.com";
$mail->AddAddress($address, "John Doe");

if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Message sent!";
}
?>

Link to comment
Share on other sites

I will download phpmailer and give it a try and let you know.

 

Do you know if on a live hosting server, not localhost, would I still need to download phpmailer for it to work and how does the process work compare with local environment?  I know my host provide built in form mail but it is limited in it's function from what I've seen.

 

1 - limited in number of email it can send out

2 - limited in standard subject line etc.  and maybe other limitation I may not know of, is why I like to customized my own script and create flexibility.

Link to comment
Share on other sites

You don't need it it just makes like eaiser for you..

No matter where your mail server is located limits are limts, you could host it yourself but that can cause other problems, limit on mails send shouldn't be a problem (depends what your sending i guess), i have no idea what you mean by "limited in standard subject line"

 

as for the setting for yahoo, yes you can use them in outlook but the setting are the same

host:port, connection type, username, password

Link to comment
Share on other sites

i have no idea what you mean by "limited in standard subject line"

 

I just tested my host formmail built in function:

 

this is what it said to do:

 

You have to modify the following code on your form page:

<form action="/cgi/formmail" method = "POST">

 

2. Specify Recipient E-mail address  (limit is maximum 2 recipients)

 

Next you must have the following line of code after the form action tag we entered above:

 

<input type=hidden name="recipient" value="you@yourdomain.com">

OR

<input type=hidden name="recipient" value="you@yourdomain.com,anothername@anotherdomain.com">

 

when I set up the form and tested it so it send it to my personal email, I noticed that

the subject is:

WWW Form Submission and there is a limit on two email distribution, I would like more.  and what if I want the action to run another php program, then I can't use their formmail built in.

Link to comment
Share on other sites

yea I looked at my email and I see it sent from the from.  But I would like it to send to not just two but more, customized subject either I set it or user filled it, and I would like to run other php/html application while do so. 

Link to comment
Share on other sites

To send to more just use

$mail->AddAddress("John@doe.com", "John Doe");
$mail->AddAddress("Jane@doe.com", "Jane Doe");

 

subject, same idea

$mail->Subject    = "PHPMailer Test Subject via smtp (Gmail), basic";

 

I would like to run other php/html application while do so. 

No idea what you mean!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.