Forum Moderators: coopster

Message Too Old, No Replies

email form, ajusting sender address

email is sent from anonymous@cgi6.cgi6 and getting rejected

         

spliffy

10:44 am on Apr 12, 2007 (gmt 0)

10+ Year Member



Hello, wonderful community you all have here. I look forward to contributing in all the areas i am knowledgeable in. namely design, accessibility, css, and semantic xhtml (and my ruby chops are growing).

This has been lighting my hair on fire, I'm a real noob with php and despite my listed specialties above, I had to use flash for this project.

this little app in a nutshell is supposed to
1. let the user enter in their data
2. send a confirmation to the user in html, ugh :(
3. send a list of the variables to the boss (my client) again in html

and is composed of
1. a flash form
2. a small php script.
3. 2 html documents (boss_email.html & user_email.html)

i think that the problem is that the emails are sent from anonymous@cgi6.cgi6 and getting rejected. they work in yahoo mail, but not any other service. if it is of any use, the host is netfirms.

here is the php doc that accepts the variables from flash, it then sends the 2 html docs and switches out predefined strings with the variables

<?php

$szFirstName = $_POST["firstName"];
$szLastName = $_POST["lastName"];
$szAddress = $_POST["address"];
$szCity = $_POST["city"];
$szState = $_POST["state"];
$szZip = $_POST["zip"];
$szEmail = $_POST["email"];
$szSponsor = $_POST["sponsor"];
$szAuth = $_POST["auth"];
$szDPhone = $_POST["dPhone"];
$szCPhone = $_POST["cPhone"];
$szIssue = $_POST["issue"];

// Set up the header information
$headers = "Content-Type: text/html; charset=\"us-ascii\"\r\n";

// Read and parse the user's email
$filearray = file("user_email.html");
while(list(,$line) = each($filearray))
{
$line = str_replace("FIRSTNAME", $szFirstName, $line);
$line = str_replace("LASTNAME", $szLastName, $line);
$line = str_replace("EMAIL", $szEmail, $line);
$line = str_replace("ADDRESS", $szAddress, $line);
$line = str_replace("CITY", $szCity, $line);
$line = str_replace("STATE", $szState, $line);
$line = str_replace("ZIPCODE", $szZip, $line);
$line = str_replace("D_PHN", $szDPhone, $line);
$line = str_replace("C_PHN", $szCPhone, $line);
$line = str_replace("ISSUE", $szIssue, $line);
$line = str_replace("SPONSOR", $szSponsor, $line);
$line = str_replace("AUTH", $szAuth, $line);

$user_email .= $line;
}

// Read and parse the boss's email
$filearray = file("boss_email.html");
while(list(,$line) = each($filearray))
{
$line = str_replace("FIRSTNAME", $szFirstName, $line);
$line = str_replace("LASTNAME", $szLastName, $line);
$line = str_replace("EMAIL", $szEmail, $line);
$line = str_replace("ADDRESS", $szAddress, $line);
$line = str_replace("CITY", $szCity, $line);
$line = str_replace("STATE", $szState, $line);
$line = str_replace("ZIPCODE", $szZip, $line);
$line = str_replace("SPONSOR", $szSponsor, $line);
$line = str_replace("AUTH", $szAuth, $line);
$line = str_replace("D_PHN", $szDPhone, $line);
$line = str_replace("C_PHN", $szCPhone, $line);
$line = str_replace("ISSUE", $szIssue, $line);

$boss_email .= $line;
}

// Send the user's email
$subject = "user confirm";
mail($szEmail, $subject, $user_email, $headers);

// Send the boss's email
$sendTo = "bossmail@example.com";
$subject = "boss confirm" . " " . $szFirstName . " " . $szLastName;
mail($sendTo, $subject, $boss_email, $headers);

?>

i know this isn't the optimal way to do this, but i have no perl fu. how do i adjust who the sender in this script so that it won't come from that sketchy address and get rejected? i just need a static sender like system@example2.com

please assume the utmost noobitity of me with your answers.

[edited by: eelixduppy at 10:57 am (utc) on April 12, 2007]
[edit reason] use example.com [/edit]

Scally_Ally

11:40 am on Apr 12, 2007 (gmt 0)

10+ Year Member



Hi,
you can put extra headers into your mail script to show who the mail is coming from (or supposed to be coming from).

Try something like this.

$headers = "Content-Type: text/html; charset=\"us-ascii\";\r\n";
$headers .= "From: example <example@example.com>; \r\n";

Ally

spliffy

1:51 pm on Apr 12, 2007 (gmt 0)

10+ Year Member



wow thanks Scally_Ally! that worked perfect.

however, i am still unable to receive these messages through any mail service except yahoo.

why would they be rejected entirely? is there a quick fix?

Scally_Ally

3:51 pm on Apr 12, 2007 (gmt 0)

10+ Year Member



Have you checked in the junk folders of the email addresses that do not receive the mail? Has the mail gone in there?

If not try sending to a few other different emails and see what the result is, there may be a mail queue on your server.

spliffy

2:04 pm on Apr 13, 2007 (gmt 0)

10+ Year Member



thanks again scally ally :)

and I sure did, about 10 of them to various accounts never arrived. all of the emails sent to yahoo mail did though. i tested my POP and IMAP accounts on different hosts, lycos, hotmail and gmail.