Jump to content

how to send mail in php with $mailto


This topic is 6135 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I am working on a form and it is working well, but when try to add the following line:

$mailto .= .$sub_email. ;

it is not working right because what I am trying to do is for the person who had submitted the form to get a copy of their submittion.

Advance thanks.

I am using php code as follows:

<?php

$mailto = '[email protected]' . ', ' ;

$mailto .= .$sub_email. ;

$subject="E-mail Page";

$formurl="formula.php";

$errorurl="mailerror.php";

$thankyouurl="ThankYou.php";

$YES = $_POST[YES];

$Name = $_POST[Name];

$sub_email = $_POST[sub_email];

$Phone = $_POST[Phone];

$Mailing_address = $_POST[mailing_address];

$City = $_POST[City];

$State = $_POST[state];

$Zip_Code = $_POST[Zip_Code];

$messagetext = 'Email Testing';

mail($mailto, $subject, $messagetext, "From: "$Name"

<$email>nReply-To: "$sub_email"

<$email>nXMailer: chfeedback.php 2.01");

header("Location: $thankyouurl");

exit;

?>

Link to comment
Share on other sites

php2005,

As far as I know, the line should read

$mailto .= $sub_email;

enclosing the variable name in the '.' concatenation operator appears to be incorrect.

Later in the code, the indexes into the $_POST array are not enclosed in quotes. This would be correct if those are constants, but...

Regards, Don

Link to comment
Share on other sites

Don,

Thank you for the help.

It did work but for some reason the e-mail only comes to me if I use the in house e-mail account.

For example in my web form I type [email protected] at the field $sub_email I do not get any e-mail at my yahoo account, but if in case I type the inhouse e-mail account at $sub_email it will show at my e-mail account. Do you have any idea what can be the problem?

thank you

Link to comment
Share on other sites

php2005,

So, if you enter a your inhouse email at $sub_email so that $mailto becomes

[email protected], [email protected]

you will receive two emails. If you only receive one, then the problem is with concatenating the second address; but if you provide values so that $mailto becomes

[email protected], [email protected]

you only receive mail at scm1m2m3?

I'm not sure what could be going on here. These are some thoughts:

Are you certain the 2nd address is working and is correct. Try a 3rd address.

If you put the second address in $mailto all by itself does it work?

What happens if you assign values so that $mailto becomes

[email protected], [email protected]

?

regards, Don

Link to comment
Share on other sites

Assuming you DO get two message in the last example,

it sounds a bit like there is some problem sending mail to domains other than your inhouse domain. This is not an area I'm knowledgeable in. Do you have an inhouse IT department that manages your servers? They may be able to explain why you can send to your local domain and not an external domain.

Regards, Don

Link to comment
Share on other sites

This topic is 6135 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.