You're right in that I'm the main developer. I'm actually the sole developer as of now. I'm hoping to open up the project on SourceForge to new developers once the new version settles in.
Glad you got it working anyway
Moderators: Chris Corbyn, General Moderators
Code: Select all
/** 12 **/
//Try sending the email.
// Redirect to success page on success, or form on failure
if ($swift->send("yourname@example.com", $email, $subject))Code: Select all
/** 12 **/
//setup the sentfrom
$sentfrom = '"' . $user_name . '" <' . $email . '>';
//Try sending the email.
// Redirect to success page on success, or form on failure
if ($swift->send("yourname@example.com", $sentfrom, $subject))Code: Select all
/** 12 **/
//setup the sentfrom
$sentfrom = '"' . $firstname . ' ' . $lastname . '" <' . $email . '>';
//Try sending the email.
// Redirect to success page on success, or form on failure
if ($swift->send("yourname@example.com", $sentfrom, $subject))Code: Select all
/** 12 **/
//setup the sentfrom
$sentfrom = '"' . $firstname . ' ' . $lastname . '" <' . $email . '>';
//sent to multiple people
$sendtolist = array ("yourname@example.com", "yourfriend@gmail.de", "yourboss@whipcrackers.net");
//Try sending the email.
// Redirect to success page on success, or form on failure
if ($swift->send($sendtolist, $sentfrom, $subject))Code: Select all
$sender = new Swift_Address("Foo@bar.com", "Mickey Jones");Code: Select all
if ($recip == 'fish') {
$addy = "email address 1";
} elseif ($recip == 'ships') {
$addy = "email address 2";
}Code: Select all
if ($swift->send($addy, $email, $subject))Code: Select all
<div class="row">
<div class="label">Select<span class="required">*</span></div>
<div class="field">
<select name="recip">
<option value="fish">Fish</option>
<option value="ships">Ships</option>
</select>
</div>
</div>Code: Select all
$recip = 'ships';Code: Select all
if ($_POST['recip'] == 'fish') { //...and so on (assuming your form uses POST)Code: Select all
/** 6 **/
//This is a RegExp I've adopted for validating email addresses. NOTE that it's NOT RFC compliant.
// Use another regexp at your own choice
$email_re = '(?#Start of dot-atom
)[-!#\$%&\'\*\+\/=\?\^_`{}\|~0-9A-Za-z]+(?:\.[-!#\$%&\'\*\+\/=\?\^_`{}\|~0-9A-Za-z]+)*(?#
End of dot-atom)(?:@(?#Start of domain)[-0-9A-Za-z]+(?:\.[-0-9A-Za-z]+)*(?#End of domain))?';
//Now check if the email address they gave is valid, redirect back to the form if not
if (!preg_match('/^' . $email_re . '$/', $email))
{
header("Location: ../contact.php?error=email_invalid");
exit();
}Code: Select all
$email_re = '(?#Start of dot-atom
)[-!#\$%&\'\*\+\/=\?\^_`{}\|~0-9A-Za-z]+(?:\.[-!#\$%&\'\*\+\/=\?\^_`{}\|~0-9A-Za-z]+)*(?#
End of dot-atom)(?:@(?#Start of domain)[-0-9A-Za-z]+(?:\.[-0-9A-Za-z]+)*(?#End of domain))';Code: Select all
[/php ] tags not [code ] [/code ] ;)Ah, I see.d11wtq wrote:The regexp will accept "g" or "foo" or "bar" etc as valid email addresses. Internal mailing software often uses "local addresses" in this form.
So simple! Still got much to learn.If you'd rather not allow that, just take out the trailing "?" in $email_re
PS: When posting PHP code in the forums please useCode: Select all
[/php ] tags not [code ] [/code ] ;)[/quote] Oops! Will do. Never noticed the option. Many thanks for your help, and all your work on Swiftmailer Regards, Lunarman
Code: Select all
How did you hear about us?<br />
<input type="checkbox" name="marketsource[1]" value="Barney" /> Barney
<input type="checkbox" name="marketsource[2]" value="Waldo" /> Waldo
<input type="checkbox" name="marketsource[3]" value="Dr. Who" /> Dr. Who
<input type="checkbox" name="marketsource[4]" value="McGruff" /> McGruff<br />
<input type="checkbox" name="marketsource[5]" value="Grommit" /> Grommit
<input type="checkbox" name="marketsource[6]" value="Vegemite" /> Vegemite
<input type="checkbox" name="marketsource[7]" value="Marmite" /> Marmite<br />
<input type="checkbox" name="marketsource[8]" value="Dolemite" /> Dolemite
<input type="checkbox" name="marketsource[9]" value="Other" /> OtherCode: Select all
$marketsource = $_POST["marketsource"];Code: Select all
if (!empty($marketsource))
{
$body .= "The contact indicated they found us via the following source(s): " . $marketsource . "\r\n";
}Code: Select all
$marketsource = implode(", ", $_POST["marketsource"]);Code: Select all
[/ php] tags rather than [code ] [/ code] tags when posting PHP code :)Code: Select all
$marketsource = implode(", ", $_POST["marketsource"]);
//$marketsource = $_POST["marketsource"];Code: Select all
{
unset($_SESSION["post"]); //It worked, we have no reason to keep this data
$swift->close();
header("Location: contact_us_thanks.php"); /** 13 **/
exit();
}Code: Select all
Warning: implode(): Bad arguments. in /usr/local/apache/hosts/domain/pub/parseandsend.php on line 50
Warning: Cannot modify header information - headers already sent by (output started at /usr/local/apache/hosts/domain/pub/parseandsend.php:50) in /usr/local/apache/hosts/domain/pub/parseandsend.php on line 158Code: Select all
var_dump($_POST["marketsource"]);Code: Select all
string(5) "Array"Code: Select all
$marketsource = array();
$marketsource = implode(", ", $_POST["marketsource"]);