Send Sign Up Form Results to Email Address Via PHP [closed] - phpmailer

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I have a question about PHP email function, I hope you can help me with this. I have little to no experience in PHP.
Ive set up a web page, where users can submit following info via the HTML form:
Name, Email, Phone, and couple Drop Down Selectors.
I have created an empty form.php and when clicked on submit, it gets connected to that php file. Thing is, I want the results to be mailed to my email address WIHOUT mysql database, as far as I know this is possible with PHP, but I couldnt find any tutorial for this.
Can you give me any pointers or guides please, how can I do it ?
Thanks in advance
Cheers : ))
EDIT: I forgot to mention, with some PHP tutorials, I managed to send the mail to my email address, and managed to get the email subject correctly, but I couldnt get the results of email in the body of the email sent, body is always empty.
Can you please give me an example script, how I could get the results of this form in the body of message? Most tutorials show how to get $message in the body, but I dont really have any text to send via $message. I simply have couple text fields and couple drop down selectors.

Just try this:
<?php
$to = "someone#example.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse#example.com";
$headers = "From:" . $from;
if(mail($to,$subject,$message,$headers)){
echo "Mail Sent.";}
else{
echo "Mail not sent";
}
?>
EDIT:
1: soneonelse#example.com; and 'someonelse#example.com are just two different email, like it mentions about the sender and the receiver of the email
So, make sure to change the email I have given above to the email you want to send.
2: If you want to style <div> then do something like this:
echo "<div style='color:white; background-color:red; font-size:14px; padding:20px;
border:1px solid black;'> Mail Sent</div>";

Use mail() function:
mail($to, $subject, $message);
Details in manual: http://php.net/manual/en/function.mail.php

Related

Kentico 11 - Macro's not working in Marketing Emails

I have just started to use Kentico, so far everything has been straight-forward however I cannot get certain Macro's to work in Marketing Emails (to insert personalized information in the email such as their country).
Here is a quick overview of my automation process
Person submits a form on the website
Form field information gets mapped to the contact
Automation process begins
Internal/Transactional email sent which contains the requesters information (Macro's work)
Marketing email sent to requester, containing relevant information (Only basic Macro's work (for example recipient.firstname))
The issue is that the Macro's that are used (and working) in the internal transactional email do not appear to work in the marketing emails section, for example: {% OnlineMarketingContext.CurrentContact.ContactCountry #%} would copy in the requesters Country in the transactional/internal email, but it remains blank in marketing emails (Note: I have tested this fully, not as a draft email as I've read that the information doesn't get passed in a draft email).
I have tried using different objects (ContactManagementContext, etc.), however nothing appears to bring in personalized information.
Is there something I need to do to get the Macro's working within the Marketing Emails section? I have read through the docs online and I can't find anything to make this work.
Any help would be greatly appreciated.
The newsletter email macros are based off the subscriber not the contact. If you want to use the contact info, you will have to find a way to relate the subscriber to the contact.
This video shows how to see what macros are available.
Zach is correct. Normally, you would lookup the Contact based on the email address of the Recipient, e.g. {%GlobalObjects.Contacts.Where("ContactEmail = '"+Recipient.Email+"'").TopN(1).FirstItem%}. However, there is a hidden object you can use in marketing emails: {%Advanced.ContactInfo%}

How to extract the url from an embedded link in an email

I've got an email processing agent. It copies the body of the email into a document's rich text field. If there are any embedded links in the email I want to process that embedded link and extract the url. I started playing around with MIMEEntity but nothing came of it. Any ideas?
thanks
clem
================
Hi Rich,
Well here's a more robust explanation of what's going on. I have several Notes apps which deal with email correspondence. An email comes in, a Notes document is created with some meta data (system generated ID, user's email, name, company, status, etc). The email body is added to a 'correspondence' rich text field of the created Notes doc. The app allows for someone on our side to follow up on the email (ask a question, provide some feedback, etc). That response from us is pre-pended to the original email. If the original sender responds with some further information, THAT email is also pre-pended. To do this pre-pending, I do
bodyText = EmailDoc.GetFirstItem("Body").text
textFromNotesDoc = CTdoc.GetFirstItem("Issue").text
newTextFromNotesDoc = bodyText + <some stuff> + textFromNotesDoc
I then do a replace.
This worked perfectly fine for years. However, recently users have been sending in emails containing embedded links. Of course anything like that is lost when I do the NotesDocument.GetFirstItem().Text. So I've been trying to think of a way to capture the embedded link. The other day it occurred to me that if I could read the html, I could find and extract the url and simply add it to text. I thought maybe using NotesMIMEEntity would allow me to read through the body field and find the url but that's not working.
Clem
The solution is to NOT NotesDocument.GetFirstItem().Text. Just simply take the email coming in and prepend the body field to the discussion RT field. I add tags to the email going out so that I know if the person responding included the previous conversation. That took a little work to figure out but by using NotesRichTextNavigator and related classes, I'm able to deal with that.
clem

Passing Reference with PHP

as you can see i am very new in PHP world.
I am able to show my Mysql table list but i want to add some link to show some further information but i couldnt get id reference on address bar.
on the below line something wrong buty i couldnt find it
echo .$row['name']."";
this is the address i get on address bar
http://test.com/new/details.php?ref=
as you can see i did not receive id , If i put ID manualy code works and shows details
I appreciate your help
Thanks
try
echo "<a href='details.php?ref=" .$row['id']. "'>" .$row['name']."</a>";

encrypting "register.php?username=jz&email=jz#hotmail.com"

I have a url address on my website:
register.php?username=jz&email=jz#hotmail.com
the code used to create this url address is currently:
echo '<p class="c7">Click here to back and try again.<br><img src="resources/img/spacer.gif" alt="" width="1" height="15"></p>';
I am currently using GET on register.php to retrieve the values
I was wondering if anyone could show me any encrypting/decrypting methods to mask this data passed from page to page to the user to prevent any tampering from the user.
For example what could I replace the username/email variables with in the URL for example
register.php?u=jz&e=jz#hotmail.com
or this
register.php?token=khkhkhg33424g
token being the username/email value merged and encrypted but of course on register.php the information can be descrambled and split back into the two variables of username and email to be echoed on the form
These are just a few ideas that I'm hoping to develop.
Use sessions.
<?php
session_start();
$_SESSION['username'] = $username;
$_SESSION['email'] = $email;
var_dump($_SESSION);
Only people with access to your server can modify this data.
Store those variables in $_SESSION and check their values from there instead of looking for them in $_GET.

=?UTF-8?B??= in Emails sent via php mail problem

I have a website, and in the "Contact" section I have a form which users may fill in to contact me.
The form is a simple form which action is a php page.
The php code:
$to = "email#domain.com";
$name=$_POST['name']; // sender name
$email=$_POST['email']; // sender email
$tel= $_POST['tel']; // sender tel
$subject=$_POST['subject']; // subject CHOSEN FROM DROPLIST, ALL TESTED
$text=$_POST['text']; // Message from sender
$text.="\n\nTel:".$tel; // Added to message to show me the telephone nr to the sender at bottom of message
$headers="MIME-Version: 1.0"."\n";
$headers.="Content-type: text/plain; charset=UTF-8"."\n";
$headers.="From: $name <$email>"."\n";
mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $text, $headers, '-fno-reply#domain.com');
Could somebody please tell me why this works most of the time, but sometimes I receive email whith no text and the subject line showing
=?UTF-8?B??=
I use outlook express, and I have read this System.Net.Mail and =?utf-8?B?XXXXX.... Headers
but it didn't help.
The problem is not in Outlook, because when I log in to the actual mailprogram where I fetch the POP3 emails from, the email looks the same.
When I right click in Outlook and chose "message source" then there is no "From" information.
Ex, a good message should look like this:
Subject: =?UTF-8?B?w5Z2cmlndA==?=
MIME-Version: 1.0
Content-type: text/plain; charset=UTF-8
From: John Doe
However, the ones with problem looks like this:
Subject: =?UTF-8?B??=
MIME-Version: 1.0
Content-type: text/plain; charset=UTF-8
From:
As if the information has been lost somewhere.
You should know also that I have a VPS, which I manage myself.
I use postfix as an emailserver, if thats got anything to do with it.
But then again, why does it work sometimes?
Also another thing that I have noticed is that sometimes special characters are not shown correctly (by both Outlook and the webmail).
For instance, the name "Björkman" in swedish is shown like Björkman, but again, only sometimes.
I hope anybody knows something about this problem, because it is very hard to track down for me atleast.
If you need more input let me know.
Looks like the form is posted with all fields left blank. There are bots crawling the net and submitting empty forms. Have you been able to reproduce this with actual form data?
Additional hint: your code is open to email header injection - I can post any headers I want, separated by line breaks, in $_POST['name'] and your code will put it into the email headers. At least remove any line breaks from user data that will go into the header section.

Resources